System.InvalidOperationException : Eyes not open
Mikael Bendtsen — Feb 23, 2016 10:12AM UTC
I'm really impressed by Applitools Eyes and will most likely sign up for something else than the free license when I am done with my proof of concept. Great work Applitools! :)
I'm using the Selenium Webdriver APIs in an .NET/C# environment with NUnit as test framework+runner.
All tests inherit from a common test base class specifying the methods to setup and tear down the tests. From the tear down method I do this:
// EyesInstance = object returned when creating a new Eyes object
// Instance = driver instance returned from EyesInstance.Open()
Then a System.InvalidOperationException : Eyes not open exception is thrown and I cannot really see why. What am I doing wrong here?
TearDown failed for test fixture TRexTests.SystemTests.TRexTest
One or more child tests had errors
TearDown : System.InvalidOperationException : Eyes not open
at Applitools.EyesBase.Close(Boolean throwEx)
at TRexTests.SystemTests.Framework.Core.Driver.Quit() in C:\TelenorSe\telenorse-trex\TRex.Tests\SystemTests\Framework\Core\Driver.cs:line 30
at TRexTests.SystemTests.TRexTest.TearDown() in C:\TelenorSe\telenorse-trex\TRex.Tests\SystemTests\TRexTest.cs:line 18
NUnit Adapter 22.214.171.124 executing tests is finished
========== Run test finished: 19 run (0:02:11.0161331) ==========
4 Community Answers
Matan Carmi - Feb 23, 2016 at 11:01AM UTC
Thanks for the kind feedback!
This exception typically happens when you try to call CheckWindow before calling eyes.open. Can you please make sure that you have a call to eyes.open at the beginning of your test (you can find a code sample in the tutorial feature
In case you will face any issues in getting this to work, please email us your test code to support at applitools and we will send some suggestions for how to fix it.
Mikael Bendtsen - Feb 23, 2016 at 12:08PM UTC
Maybe it wasn't clear in my original post, but this error does not occur when CheckWindow is called but when the Close() method is invoked on the Eyes object.
Matan Carmi - Feb 23, 2016 at 12:24PM UTC
Could you please make sure you don’t call eyes.close() twice in a row by mistake.
I used to place a breakpoint on eyes.close and debug it step by step in such occasions.
Basically Eyes not open error say that the test didn’t open or was already closed once (and now it not open)
Let me know if it still persists, we could make a quick websession on this.
Mikael Bendtsen - Feb 24, 2016 at 12:05PM UTC
The issue still persists and I would appreciate if we could make a quick websession on this.