Skip to content

UnreachableBrowserException when implicitlyWait > 60s #8217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mmajcherczyk opened this issue Apr 18, 2020 · 8 comments
Closed

UnreachableBrowserException when implicitlyWait > 60s #8217

mmajcherczyk opened this issue Apr 18, 2020 · 8 comments
Labels
C-java Java Bindings

Comments

@mmajcherczyk
Copy link

🐛 Bug Report

UnreachableBrowserException instead of NoSuchElementException when implicitlyWait greater than 60s

To Reproduce

run this test(selenium 4.0.0-alpha-5)

@Test
public void test() {
    WebDriverManager.chromedriver().setup();
    ChromeOptions options = new ChromeOptions();
    WebDriver driver = new ChromeDriver(options);
    driver.manage().timeouts().implicitlyWait(61, TimeUnit.SECONDS);
    driver.get("https://google.com");
    driver.findElement(By.id("identifierId"));
    driver.quit();
}

I get an error message:

org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
Build info: version: '4.0.0-alpha-5', revision: 'b3a0d621cc'
System info: host: 'MacBook-Pro-2', ip: 'fe80:0:0:0:31:8ff8:ab39:5031%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.3', java.version: '1.8.0_191'
Driver info: driver.version: RemoteWebDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 81.0.4044.113, chrome: {chromedriverVersion: 80.0.3987.106 (f68069574609..., userDataDir: /var/folders/hd/yrwc8tsx1tv...}, goog:chromeOptions: {debuggerAddress: localhost:50634}, 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: 8cbbf47848747b325357288d3e32a0d9
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:603)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:333)
at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:381)
at org.openqa.selenium.By$ById.findElement(By.java:194)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:325)

Expected behavior

I am expecting an error: NoSuchElementException

when implicitlyWait less than 60 second is ok, I get NoSuchElementException

Environment

OS: OSX 10.15.3
Browser: Chrome
Browser version: 81.0.4044.113
Browser Driver version: ChromeDriver 80.0.3987.106

@ghost ghost added the A-needs-triaging A Selenium member will evaluate this soon! label Apr 18, 2020
@AutomatedTester
Copy link
Member

This is likely an issue in Chromedriver not keeping the connection open for long enough. Please raise an issue with the ChromeDriver team

Please log chromedriver issues with the chromedriver project.

https://sites.google.com/a/chromium.org/chromedriver/help

Please be sure to include a completely reproducible test script for them, without a way to reproduce the issue you are seeing there is no good way for them to fix the problem. A reproducible test script includes a WebDriver script and a link to the page in question. If you can not provide a link, create one using jsfiddle.net

@mmajcherczyk
Copy link
Author

@AutomatedTester it's not the chromedriver fault. I have the same error on firefox

org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
Build info: version: '4.0.0-alpha-5', revision: 'b3a0d621cc'
System info: host: 'MacBook-Pro-2', ip: 'fe80:0:0:0:31:8ff8:ab39:5031%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.3', java.version: '1.8.0_191'
Driver info: driver.version: RemoteWebDriver
Capabilities {acceptInsecureCerts: true, browserName: firefox, browserVersion: 75.0, javascriptEnabled: true, moz:accessibilityChecks: false, moz:buildID: 20200403170909, moz:geckodriverVersion: 0.26.0, moz:headless: false, moz:processID: 58277, moz:profile: /var/folders/hd/yrwc8tsx1tv..., moz:shutdownTimeout: 60000, moz:useNonSpecCompliantPointerOrigin: false, moz:webdriverClick: true, pageLoadStrategy: normal, platform: MAC, platformName: MAC, platformVersion: 19.3.0, rotatable: false, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: e1a117d3-2a21-9843-9e1c-f9088e04c9e1

at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:603)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:333)
at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:381)
at org.openqa.selenium.By$ById.findElement(By.java:194)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:325)

in selenium 3.141.59 the problem does not occur

@barancev barancev reopened this Apr 21, 2020
@barancev barancev added the C-java Java Bindings label Apr 21, 2020
@AutomatedTester
Copy link
Member

This is likely hitting a HTTP client hitting a timeout after 1 minute.

@AutomatedTester AutomatedTester removed the A-needs-triaging A Selenium member will evaluate this soon! label Apr 24, 2020
@mkozachenko
Copy link

I am also getting this error when test tries to open URL that does not respond for 1 minute

@Buddy119
Copy link

This error does not occur on my side.
Envoriment:
OS: Win10
Browser: Chrome
Browser Version 85.0.4183.102
Browser Driver Version: ChromeDriver 85.0.4183.87
Selenium Version: 3.141.59

@mmajcherczyk you can try to upgrade your browser version

@mmajcherczyk
Copy link
Author

in chrome 85(selenium 4.0.0-alpha-6) when implicitlyWait equals 61 second i have error

java.lang.NoClassDefFoundError: org.openqa.selenium.WebDriverException

at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getConstructor0(Class.java:3075)
at java.lang.Class.getConstructor(Class.java:1825)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:195)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:129)
at org.openqa.selenium.remote.codec.w3c.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:53)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:160)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:582)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:333)
at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:381)
at org.openqa.selenium.By$ById.findElement(By.java:194)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:325)

@mkozachenko
Copy link

It seems that chrome option "--no-sandbox" helps to get rid of this problem. I had this error for about 6 months until I found some years old post on StackOverflow with this very easy fix and it worked. I hadn't seen this exception for almost 2 months.
@Buddy119 I got this error most of the times when the very first call of driver.get("web url") did not load anything for less then 60 seconds. Webpage has to just wait for response and not give response of any kind. You can try to emulate this with local proxy throttling - I did it with BrowserMobProxy method setLatency()

@diemol diemol closed this as completed in 1ce3671 Feb 9, 2021
@diemol
Copy link
Member

diemol commented Feb 9, 2021

The fix linked on the commit above should be available in the next beta, ~1 week from now.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C-java Java Bindings
Projects
None yet
Development

No branches or pull requests

6 participants