Kpras
Kpras

Reputation: 183

org.openqa.selenium.WebDriverException: disconnected: not connected to DevTools error using ChromeDriver Chrome using Selenium and Java

I am seeing below error and browser got disconnected between. Its happening only for chrome. Selenium version I am using is:

<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version> 

Error stack trace:

[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

Upvotes: 6

Views: 53524

Answers (3)

Albin
Albin

Reputation: 1130

Expanding on Bogdan's answer. I got the error after some idle time because sleep mode engaged temporarily. It was disengaged again when I returned to the machine so I didn't notice the cause of the problem right away.

I recommend checking for any other power-saving options or tasks that get started while your PC is idle (Event Viewer will be a good start).

Upvotes: 1

Bogdan
Bogdan

Reputation: 61

I encountered the same type of error. This error appears even with the latest ChromeDriver for Chrome browser (118.0). Local PC works fine, remote or virtual works fine until I disconnect from the machine. I think this error has to do with the user session on the remote machine, since when disconnected or screen saver kicks in the ChromeDriver loses its connection with the browser instance it controls.

The fix that worked for me: switch the sleep and screen mode to never (if Windows box).

Upvotes: 6

undetected Selenium
undetected Selenium

Reputation: 193358

This error message...

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}

...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:

  • You are using chromedriver=78.0
  • Release Notes of chromedriver=78.0 clearly mentions the following :

Supports Chrome v78

  • You are using chrome=79.0
  • Release Notes of ChromeDriver v79.0 clearly mentions the following :

Supports Chrome 79

So there is a clear mismatch between the ChromeDriver v78.0 and the Chrome Browser v79.0


Solution

Ensure that:

  • 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 and install a recent GA and released version of Web Client.
  • Take a System Reboot.
  • Execute your @Test as non-root user.
  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

Upvotes: 5

Related Questions