seleniumjenkinsgsonselenium-chromedriverselenoid

org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died with ChromeDriver and Selenium


I'm running a bunch of test cases every hour using selenium-java 3.12.0; TestNG; Selenoid with docker, Jenkins. Sometimes (about 1 out of 10 cases) I get the error:

org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
System info: host: 'autotest.rvkernel.com', ip: '94.130.165.217', os.name: 'Linux', os.arch: 'amd64', os.version: '4.13.0-26-generic', java.version: '1.8.0_181'
Driver info: driver.version: RemoteWebDriver
Capabilities [{mobileEmulationEnabled=false, hasTouchScreen=false, platform=LINUX, acceptSslCerts=false, acceptInsecureCerts=false, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, platformName=LINUX, setWindowRect=true, unexpectedAlertBehaviour=, applicationCacheEnabled=false, rotatable=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.39.562737 (dba483cee6a5f15e2e2d73df16968ab10b38a2bf), userDataDir=/tmp/.org.chromium.Chromium.gURWcu}, takesHeapSnapshot=true, pageLoadStrategy=normal, unhandledPromptBehavior=, databaseEnabled=false, handlesAlerts=true, version=67.0.3396.62, browserConnectionEnabled=false, nativeEvents=true, locationContextEnabled=true, cssSelectorsEnabled=true}]
Session ID: 56c4b100a95d89b3d5702ec8a1a0698a
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:564)
    at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:276)
    at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:83)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement$1.invoke(EventFiringWebDriver.java:376)
    at com.sun.proxy.$Proxy14.click(Unknown Source)
    at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement.click(EventFiringWebDriver.java:389)
    at com.Elements.Element.lambda$click$2(Element.java:99)
    at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:208)
    at com.Elements.Element.click(Element.java:98)
    at com.Elements.Element.click(Element.java:78)
    at com.pages.landing.social.MailRuRegisterPage.clickRegister(MailRuRegisterPage.java:37)
    at RulVulaknTests.authorization.AuthorizationTest.authorizationUserFromMailRU(AuthorizationTest.java:100)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:571)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:707)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:979)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: Cannot decode response content: 
    at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:83)
    at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
    ... 28 more
Caused by: org.openqa.selenium.json.JsonException: java.io.EOFException: End of input at line 1 column 1 path $
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
System info: host: 'autotest.rvkernel.com', ip: '94.130.165.217', os.name: 'Linux', os.arch: 'amd64', os.version: '4.13.0-26-generic', java.version: '1.8.0_181'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.json.JsonInput.execute(JsonInput.java:172)
    at org.openqa.selenium.json.JsonInput.peek(JsonInput.java:72)
    at org.openqa.selenium.json.JsonTypeCoercer.lambda$null$6(JsonTypeCoercer.java:136)
    at org.openqa.selenium.json.JsonTypeCoercer.coerce(JsonTypeCoercer.java:122)
    at org.openqa.selenium.json.Json.toType(Json.java:62)
    at org.openqa.selenium.json.Json.toType(Json.java:52)
    at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
    ... 31 more
Caused by: java.io.EOFException: End of input at line 1 column 1 path $
    at com.google.gson.stream.JsonReader.nextNonWhitespace(JsonReader.java:1401)
    at com.google.gson.stream.JsonReader.consumeNonExecutePrefix(JsonReader.java:1576)
    at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:534)
    at com.google.gson.stream.JsonReader.peek(JsonReader.java:425)
    at org.openqa.selenium.json.JsonInput.lambda$peek$0(JsonInput.java:73)
    at org.openqa.selenium.json.JsonInput.execute(JsonInput.java:168)
    ... 37 more

And after this error all remained tests are skipped.

Versions of chrome browser using which I have encountered the error - 66, 67.


Solution

  • This error message...

    org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died.
    

    ...implies that the RemoteWebDriver instance was closed abruptly.

    Your code trials would have been of some help to debug the issue. Perhaps yout main issue can be one of the following: