Closed sjethvani closed 6 years ago
We are also seeing the same exception in 3.12 and 3.13 randomly at different places.
The same story here with selenium 3.13
Any one who might face this issue and coming here for a solution. I downgraded selenium standalone server to 3.9.0. It is after this version that the transition to okhttp was made in selenium and this is culprit which is causing the issue. I have been running on this version for 2 weeks now and I am not facing any issues with the connection loss. I hope this helps people who have moved to the latest version of selenium. Also I have tested with both Android and IOS and it seem to have fixed the issue for both the OS.
Try to upgrade to 3.14 instead of downgrading and retest, we attempted to resolve this issue.
Thank you Alexei Barantsev. I have spent 2 weeks on this issue and this is the only solution that has worked for me. I might upgrade to 3.14 if it is confirmed by others that the issue is fixed. This is a terrible issue which is very difficult to explain to management.
I have updated selenium from 3.8.1 to 3.14 . My scripts are working fine . Below are gradle dependencies , I changed
compile(group: 'com.google.guava', name: 'guava', version: '25.0-jre')
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.14.0'
Till now , I haven't seen any issue as such
OK, thanks for getting us know. CLosing the issue then,
I am still running into this issue. Using a grid setup using selenium-server-standalone-3.14.0.jar. Running tests from my laptop onto a grid system in Windows. I am gonna try downgrading to 3.8 and see what happens. Wish me luck. It is an intermittent issue, I am running about 200 tests and 75 fail because it's not able to connect to the hub.
river info: driver.version: AutomationDriver" type="org.openqa.selenium.remote.UnreachableBrowserException">org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z' System info: host: 'jlopezmaclt.XXXX.com', ip: '10.4.61.202', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.6', java.version: '1.8.0_60' Driver info: driver.version: AutomationDriver at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:569) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:143) at com.scilearn.automation.ui.library.common.AutomationDriver.createRemoteChromeDriver(AutomationDriver.java:220) at com.scilearn.automation.ui.library.common.AutomationDriver.getGridWebDriver(AutomationDriver.java:206) at com.scilearn.automation.ui.library.common.AutomationDriver.<init>(AutomationDriver.java:59) at com.scilearn.automation.tests.release.ReleaseSmokeTests.getStatus(ReleaseSmokeTests.java:897) at com.scilearn.automation.tests.release.ReleaseSmokeTests.foundations1Cluster2DemosTest(ReleaseSmokeTests.java:808) 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:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at com.tngtech.java.junit.dataprovider.DataProviderFrameworkMethod.invokeExplosively(DataProviderFrameworkMethod.java:77) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) at org.springframework.test.context.junit4.statements.RunPrepareTestInstanceCallbacks.evaluate(RunPrepareTestInstanceCallbacks.java:64) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) at org.springframework.test.context.junit4.statements.SpringFailOnTimeout.evaluate(SpringFailOnTimeout.java:87) at org.springframework.test.context.junit4.statements.ProfileValueChecker.evaluate(ProfileValueChecker.java:101) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.net.ConnectException: Failed to connect to XXXXX
Use 1.9.0 This has been working beautifully and I have never seen this issue again. Hope this helps.
On Tue, Oct 16, 2018, 6:46 AM javierlopez111 notifications@github.com wrote:
I am still running into this issue. Using a grid setup using selenium-server-standalone-3.14.0.jar. Running tests from my laptop onto a grid system in Windows. I am gonna try downgrading to 3.8 and see what happens. Wish me luck.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/SeleniumHQ/selenium/issues/6170#issuecomment-430066832, or mute the thread https://github.com/notifications/unsubscribe-auth/ADBUUZE_cybFiBTNECDHtrsbD82imNavks5ulTNjgaJpZM4VSTdT .
@vinaybalepur I’m going to ask that you refrain from advising any other people to downgrade to a not-current version of Selenium as a workaround to this issue. Yes, we recognize the severity and seriousness of the issue. Yes, we understand that downgrading worked for you. You made your point; there is no need to belabor it further.
Meta -
OS:
MAC OS Sierra(10.12.6) Selenium Version:
3.12 + 3.13 Browser: Chrome + Firefox
Browser Version:
Version 67.0.3396.99 (Official Build) (64-bit)
Expected Behavior -
Script should work smoothly without any intermittent exceptions like
(UnreachableBrowserException)
Actual Behavior -
I was getting intermittent org.openqa.selenium.remote.UnreachableBrowserException . So started debugging it by writing a code to catch WebDriverException (try/catch) & taking screenshot whenever script meets WebDriverException. To my surprise , I saw that screenshot was actually being taken even after getting
UnreachableBrowserException
.Doesn't UnreachableBrowserException means that session is not accessible and hence it should be invalidated . So any action performed on webdriver object of that invalidated session should throw WebDriverException.
Correct me if I am wrong & please explain the above miracle (screenshot capturing works even after getting UnreachableBrowserException)
For Analysis purpose , I am attaching stacktrace here
See in the stacktrace , I am getting UnreachableBrowserException when trying to get current url of browser , however screenshot capturing works and I can see screenshot being saved at location
org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the remote browser. It may have died. Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T14:04:26.12Z' System info: host: 'mymachine', ip: 'x.x.x.x', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_121' Driver info: driver.version: RemoteWebDriver Capabilities {acceptInsecureCerts: false, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.36.540469 (1881fd7f864150..., userDataDir: /var/folders/ym/dtyc5vz9785...}, cssSelectorsEnabled: true, databaseEnabled: false, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: MAC, platformName: MAC, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 67.0.3396.99, webStorageEnabled: true, webdriver.remote.sessionid: f4748ff254f6fe0418a37e3ab40...} Session ID: f4748ff254f6fe0418a37e3ab40c3604 at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:564) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600) at org.openqa.selenium.remote.RemoteWebDriver.getCurrentUrl(RemoteWebDriver.java:281) at getCurrentURL(MyDriverBot.java:1616) at Capture.main(Capture.java:31) Caused by: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:210) at java.net.SocketInputStream.read(SocketInputStream.java:141) at okio.Okio$2.read(Okio.java:139) at okio.AsyncTimeout$2.read(AsyncTimeout.java:237) at okio.RealBufferedSource.indexOf(RealBufferedSource.java:345) at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:217) at okhttp3.internal.http1.Http1Codec.readHeaderLine(Http1Codec.java:212) at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:189) at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:88) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200) at okhttp3.RealCall.execute(RealCall.java:77) at org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:105) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:155) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543) ... 10 more 19:25:43.232 [Capture][captureScreenShotOnDashboardException] - Start Capturing screenshot (in case of exception is found 19:25:43.233 [Capture][takeDashboardScreenshot] - Screenshot will be kept at location : /Users/myuserName/result/myException.png 19:25:44.084 [Capture][captureScreenShotOnDashboardException] - End Capturing dashboard (in case of dashboard exception is found
Steps to reproduce -
I have this problem happening beneth so many layers in my framework . So I probably have to find a way to produce clean alternative code to show this problem . Moreover as I said issue is happening randomly , which may make my job more difficult to produce clean reproducible code (however I will try)
Workaround as of now-
For me it seems to be an issue with 'OKHTTP' , I did following things to confirm it 1) Added
System.setProperty("webdriver.http.factory", "apache");
to force selenium to use 'apache' instead of 'okhttp' in selenium v3.13 . It worked , now I don't get above randomUnreachableBrowserException
exception (tested it for 2/3 times) , however execution (in terms of identifying elements) is so slow (I don't know why)2) I downgraded selenium version to use 3.8.1 (from 3.13) & restarted my machine . Built my gradle project again & executed code 2/3 times . Again I wasn't getting above
UnreachableBrowserException
exception.Can any one please raise your hand , if you are experiencing this prob in selenium v3.12 or 3.13 ?