org.openqa.selenium.NoSuchSessionException:在使用带有Java的ChromeDriver Chrome的Selenium自动化测试中,没有此类会话错误
在我的管道中运行硒时获得无此类会话异常".我发现许多与此相关的解决方案,但没有一个对我有用.有任何帮助或想法吗?异常跟踪:
Getting "No such session exception" while running selenium in my pipeline. I find many solutions related it but none worked for me. Any assistance or idea? Exception trace:
org.openqa.selenium.NoSuchSessionException: no such session
(Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Linux 3.10.0-957.21.3.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.9.1', revision: '63f7b50', time: '2018-02-07T22:25:02.294Z'
System info: host: 'chaos', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-957.21.3.el7.x86_64', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.38.552522 (437e6fbedfa876..., userDataDir: /tmp/.org.chromium.Chromium...}, cssSelectorsEnabled: true, databaseEnabled: false, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: LINUX, platformName: LINUX, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 75.0.3770.100, webStorageEnabled: true}
Session ID: e25db38f6fb8cdaac6d4a699504c608f
at sun.reflect.GeneratedConstructorAccessor129.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
我已经签入代码;没有使用driver.close()或driver.quit().测试有时会成功运行,有时会失败.
I have checked in code; there is no driver.close() or driver.quit() is used.Tests are running successfully sometime and sometimes are failing.
有人可以帮我解决这个问题吗?
Can any one help me for this issue?
此错误消息...
org.openqa.selenium.NoSuchSessionException: no such session
(Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Linux 3.10.0-957.21.3.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.9.1', revision: '63f7b50', time: '2018-02-07T22:25:02.294Z'
System info: host: 'chaos', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-957.21.3.el7.x86_64', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
...表示 ChromeDriver 无法启动/产生新的浏览上下文,即 Chrome浏览器会话.
...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.
您的主要问题是所使用的二进制文件版本之间的不兼容性:
Your main issue is the incompatibility between the version of the binaries you are using as follows:
- 您正在使用 chromedriver = 2.38
- chromedriver = 2.38 的发行说明明确提到以下内容:
支持 Chrome v65-67
- 大概您正在使用 chrome = 79.0
- ChromeDriver v79.0 明确提到以下内容:
- 您的 Selenium Client 版本是 2018-02-07T22:25:02.294Z 的 3.9.1 ,几乎是 2.
- 您的 JDK版本是 1.8.0_121 ,这很古老.
- Your Selenium Client version is 3.9.1 of 2018-02-07T22:25:02.294Z which is almost 2 years older.
- Your JDK version is 1.8.0_121 which is pretty ancient.
- JDK 已升级到当前级别JDK 8u232 .
- 硒已升级到当前级别版本3.141.59 .
- ChromeDriver 已更新为当前的ChromeDriver v79.0.3945.36 级别.
- Chrome 已更新为当前的 Chrome版本79.0 级别.(根据 ChromeDriver v79.0发行说明) 通过 IDE
- 清理您的项目工作区和重建您的项目,并且仅具有必需的依赖项.
- 如果您的基本 Web客户端版本太旧,请通过来卸载. Revo Uninstaller 并安装最新版本的 Web客户端 GA和发行版.
- 进行系统重启.
- 以非root用户用户的身份执行
@Test
. - JDK is upgraded to current levels JDK 8u232.
- Selenium is upgraded to current levels Version 3.141.59.
- ChromeDriver is updated to current ChromeDriver v79.0.3945.36 level.
- Chrome is updated to current Chrome Version 79.0 level. (as per ChromeDriver v79.0 release notes)
- Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
- If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
- Take a System Reboot.
- Execute your
@Test
as non-root user.
支持 Chrome 79版
因此 JDK v8u121 , Selenium Client v3.9.1 , ChromeDriver v2.38 和 Chrome之间存在明显的不匹配浏览器v79.0
确保: