org.openqa.selenium.WebDriverException:断开连接:未连接到 DevTools 错误使用 ChromeDriver Chrome 使用 Selenium 和 Java
org.openqa.selenium.WebDriverException: disconnected: not connected to DevTools error using ChromeDriver Chrome using Selenium and Java
我看到以下错误,浏览器之间断开连接。它只发生在 chrome。我使用的 Selenium 版本是:
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
错误堆栈跟踪:
[1579632222.785][SEVERE]: Unable to receive message from renderer
org.openqa.selenium.WebDriverException: disconnected: not connected to DevTools
(Session info: chrome=79.0.3945.117)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'MBP15-PBJGH8.8x8.com', ip: 'fe80:0:0:0:1846:114d:10a6:bf26%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '1.8.0_201'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 79.0.3945.117, chrome: {chromedriverVersion: 78.0.3904.70 (edb9c9f3de024..., userDataDir: /var/folders/mz/2_llwtkx31d...}, goog:chromeOptions: {debuggerAddress: localhost:54446}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: MAC, platformName: MAC, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 3577826ba5ac2d089a34e17f9aa987c9
这个错误信息...
org.openqa.selenium.WebDriverException: disconnected: not connected to DevTools
(Session info: chrome=79.0.3945.117)
.
.
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 79.0.3945.117, chrome: {chromedriverVersion: 78.0.3904.70 (edb9c9f3de024..., userDataDir: /var/folders/mz/2_llwtkx31d...}, goog:chromeOptions: {debuggerAddress: localhost:54446}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: MAC, platformName: MAC, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
...意味着 ChromeDriver 无法 initiate/spawn 新的 Browsing Context 即Chrome 浏览器 会话。
您的主要问题是您使用的二进制文件版本之间不兼容,如下所示:
- 您正在使用 chromedriver=78.0
- chromedriver=78.0 的发行说明清楚地提到了以下内容:
Supports Chrome v78
- 您正在使用 chrome=79.0
- ChromeDriver v79.0 的发行说明清楚地提到了以下内容:
Supports Chrome 79
因此 Chrome驱动程序 v78.0 和 Chrome 浏览器 v79.0
解决方案
确保:
- Chrome驱动程序 已更新至当前 ChromeDriver v79.0.3945.36 级别。
- Chrome 已更新至当前 Chrome 版本 79.0 级别。 (根据 ChromeDriver v79.0 release notes)
- 通过 IDE 和 [=32] 清理 您的 项目工作区 =]重建你的项目只需要依赖。
- 如果您的基础 Web Client 版本太旧,则卸载它并安装最新的 GA 和发布版本的 Web Client。
- 系统重启。
- 以 非 root 用户身份执行您的
@Test
。
- 始终在
tearDown(){}
方法中调用 driver.quit()
以优雅地关闭和销毁 WebDriver 和 Web Client 实例.
我看到以下错误,浏览器之间断开连接。它只发生在 chrome。我使用的 Selenium 版本是:
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
错误堆栈跟踪:
[1579632222.785][SEVERE]: Unable to receive message from renderer
org.openqa.selenium.WebDriverException: disconnected: not connected to DevTools
(Session info: chrome=79.0.3945.117)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'MBP15-PBJGH8.8x8.com', ip: 'fe80:0:0:0:1846:114d:10a6:bf26%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.6', java.version: '1.8.0_201'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 79.0.3945.117, chrome: {chromedriverVersion: 78.0.3904.70 (edb9c9f3de024..., userDataDir: /var/folders/mz/2_llwtkx31d...}, goog:chromeOptions: {debuggerAddress: localhost:54446}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: MAC, platformName: MAC, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 3577826ba5ac2d089a34e17f9aa987c9
这个错误信息...
org.openqa.selenium.WebDriverException: disconnected: not connected to DevTools
(Session info: chrome=79.0.3945.117)
.
.
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 79.0.3945.117, chrome: {chromedriverVersion: 78.0.3904.70 (edb9c9f3de024..., userDataDir: /var/folders/mz/2_llwtkx31d...}, goog:chromeOptions: {debuggerAddress: localhost:54446}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: MAC, platformName: MAC, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
...意味着 ChromeDriver 无法 initiate/spawn 新的 Browsing Context 即Chrome 浏览器 会话。
您的主要问题是您使用的二进制文件版本之间不兼容,如下所示:
- 您正在使用 chromedriver=78.0
- chromedriver=78.0 的发行说明清楚地提到了以下内容:
Supports Chrome v78
- 您正在使用 chrome=79.0
- ChromeDriver v79.0 的发行说明清楚地提到了以下内容:
Supports Chrome 79
因此 Chrome驱动程序 v78.0 和 Chrome 浏览器 v79.0
解决方案
确保:
- Chrome驱动程序 已更新至当前 ChromeDriver v79.0.3945.36 级别。
- Chrome 已更新至当前 Chrome 版本 79.0 级别。 (根据 ChromeDriver v79.0 release notes)
- 通过 IDE 和 [=32] 清理 您的 项目工作区 =]重建你的项目只需要依赖。
- 如果您的基础 Web Client 版本太旧,则卸载它并安装最新的 GA 和发布版本的 Web Client。
- 系统重启。
- 以 非 root 用户身份执行您的
@Test
。 - 始终在
tearDown(){}
方法中调用driver.quit()
以优雅地关闭和销毁 WebDriver 和 Web Client 实例.