SessionNotFoundException

SessionNotFoundException

我正在尝试使用chrome驱动程序执行一些测试用例,但是在4个测试用例中,只有1个正在执行,其余三个我正在获取SessionNotFoundException。我在门户网站上搜索了类似的问题,但是它们都与Internet Explorer有关,但是我正在chrome驱动程序上运行测试。
硒版本-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)

最佳答案

我更改了一些xpath,现在程序不会抛出任何异常。我真的不能理解,如果xpath错误,那么我应该获取NoSuchElementException而不是SessionNotFoundException。我试图找到一个答案,说明为什么我得到了一个错误的异常,但直到现在仍无法获得明确的答案。知道的人请分享信息

09-25 14:10