fhoeben/hsac-fitnesse-fixtures

5.2.45 and up: org.openqa.selenium.WebDriverException: disconnected: not connected to DevTools

DLeijenKeylane opened this issue · 2 comments

After many issues with our own containers (#496), we have migrated to our own image based on hsac/fitnesse-fixtures-test-jre8-chrome & hsac/fitnesse-fixtures-test-jre11-chrome. The only changes we made are to always run a set of prerun and postrun tests, and add some certificates.

This image works perfectly for HSAC 5.2.44, but with 5.2.45 and 5.3.1 we always have one or more of our suites fail with this stacktrace:
org.openqa.selenium.WebDriverException: disconnected: Unable to receive message from renderer (failed to check if window was closed: disconnected: not connected to DevTools) (Session info: chrome=117.0.5938.62) Build info: version: '4.15.0', revision: '1d14b5521b' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-1160.95.1.el7.x86_64', java.version: '11.0.20' Driver info: org.openqa.selenium.chrome.ChromeDriver Command: [21fa2f49b9685897de33d3364c4844fc, clickElement {id=9C4F0403401951CFD6F2BE84EC72BEF2_element_12254}] Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 117.0.5938.62, chrome: {chromedriverVersion: 117.0.5938.62 (25a7172909a4..., userDataDir: /tmp/.org.chromium.Chromium...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:37424}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:cdp: ws://localhost:37424/devtoo..., se:cdpVersion: 117.0.5938.62, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: ignore, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true} Element: [[ChromeDriver: chrome on linux (21fa2f49b9685897de33d3364c4844fc)] -> css selector: input[value='Save']:not([type='hidden'])] Session ID: 21fa2f49b9685897de33d3364c4844fc at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:200) at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:133) at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:52) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:191) at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:200) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:175) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:607) at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:224) at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:77)

Or sometimes (slightly different first message):
org.openqa.selenium.WebDriverException: disconnected: not connected to DevTools (failed to check if window was closed: disconnected: not connected to DevTools) (Session info: chrome=117.0.5938.62) Build info: version: '4.15.0', revision: '1d14b5521b' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-1160.95.1.el7.x86_64', java.version: '11.0.20' Driver info: org.openqa.selenium.chrome.ChromeDriver Command: [21fa2f49b9685897de33d3364c4844fc, findElements {using=class name, value=kSpinner}] Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 117.0.5938.62, chrome: {chromedriverVersion: 117.0.5938.62 (25a7172909a4..., userDataDir: /tmp/.org.chromium.Chromium...}, fedcm:accounts: true, goog:chromeOptions: {debuggerAddress: localhost:37424}, networkConnectionEnabled: false, pageLoadStrategy: normal, platformName: linux, proxy: Proxy(), se:cdp: ws://localhost:37424/devtoo..., se:cdpVersion: 117.0.5938.62, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: ignore, webauthn:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:extension:minPinLength: true, webauthn:extension:prf: true, webauthn:virtualAuthenticators: true}

It always happens at different moments in the test, in different suites. Having the browser closed and reopened does not fix the issue.
This is our defaulkt way of starting the driver:
image

I have not experienced this myself. What I saw in the past with strange unreproducible errors at random points in a test suite was that the docker container ran out of memory. Do you have any memory limits on the container? Can you monitor RAM usage during a test run?

Do you have the same error not running headless, not providing a profile (I believe the images also have a window manager so should support that)

On GitHub I saw SeleniumHQ/selenium#11809 (comment), which also reports inconsistent errors of this type

I found one answer on StackOverflow that might be related, but you are on Linux. https://stackoverflow.com/questions/59847431/org-openqa-selenium-webdriverexception-disconnected-not-connected-to-devtools#answer-77319083

Tried a few things:

  • Run with --headless=new (previously we didn't run headless).
  • Set a memory limit of 8GB (previously no limit, and machines we run on do not seem to come close to memory limits).

Issue still occurs with 5.3.7.