Reputation: 1462
I am trying to execute some test cases using chrome driver but out of 4 test cases only 1 is getting executed and for rest of the three i am getting SessionNotFoundException. I searched for the similar question on the portal but all of them are related to Internet Explorer but i am running my test on chrome driver. Selenium version- 2.42.2
Exception in thread "main" org.openqa.selenium.remote.SessionNotFoundException: no such session
(Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 128 milliseconds
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:30'
System info: host: 'Admin-PC', ip: '10.0.0.6', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_31'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, chrome= {userDataDir=C:\Users\Admin\AppData\Local\Temp\scoped_dir4568_27180}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=41.0.2272.76, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 0fcb3e702dd1c8a23261b902625df216
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:162)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:614)
at org.openqa.selenium.remote.RemoteWebDriver.close(RemoteWebDriver.java:463)
at ResumeUpdate.Screen_1_Monster.operation(Screen_1_Monster.java:224)
at ResumeUpdate.Screen_1_Monster.main(Screen_1_Monster.java:341)
Upvotes: 1
Views: 8570
Reputation: 587
If the Appium does not receive next command within 60 seconds it shuts down.
[BaseDriver] Shutting down because we waited 60 seconds for a command
[debug] [AndroidDriver] Shutting down Android driver
In my case, my automation was in a loop for more than 60 secs, for the app to finish it's task, which had network dependency.
You can avoid this by adding 'newCommandTimeout' to the capabilities, to increase timeout duration, like so:
capabilities.setCapability("newCommandTimeout", 90); //or seconds
Or you can add try / catch and log more meaningful message.
Upvotes: 0
Reputation: 1462
I changed some of the xpath and now the program won't throw any exception. I really not able to undertand that if the xpath was wrong then i should have recived NoSuchElementException instead of SessionNotFoundException. I tried to find an answer about why i am getting a wrong exception but till now not able to get a clear answer. Anyone who know about it please share the information
Upvotes: 1
Reputation: 8375
I also faced this problem recently and in my case browser was closing before test can run. e.g.
...........
"Login page" - {
"should have title" in {
pageTitle should be ("Login")
}
close()
}
..........
Replaced with
...........
"Login page" - {
"should have title" in {
pageTitle should be ("Login")
close()
}
}
..........
And fixed the issue.
Upvotes: 0