Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UnreachableBrowserException: Could not start a new session Possible causes are invalid address of the remote server or browser start-up failure

I am new to selenium. Able to configure selenium set up on Ubuntu.Configuration details given below:

  • Google Chrome 68.0.3440.84
  • ChromeDriver 2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706)
  • Jenkins ver. 2.193
  • ubuntu-18.04
  • Selenium 3.13.0
  • OpenJDK 1.8
  • Doc referred for selenium set up : https://tecadmin.net/setup-selenium-chromedriver-on-ubuntu/

But every run I am getting below error on jenkins :

Opening chrome driver
Oct 30, 2019 1:26:49 PM org.openqa.selenium.remote.DesiredCapabilities chrome
INFO: Using `new ChromeOptions()` is preferred to `DesiredCapabilities.chrome()`
[ERROR] Tests run: 3, Failures: 1, Errors: 0, Skipped: 2, Time elapsed: 0.998 s <<< FAILURE! - in TestSuite
[ERROR] setUp(com.test.WebAppTitleTestOnChrome)  Time elapsed: 0.895 s  <<< FAILURE!
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.

Please suggest me.

like image 873
Moumita Das Avatar asked Sep 20 '25 00:09

Moumita Das


2 Answers

The reason why this happens.

  • When the test does not get executed within 3 minutes(Default timing) then it will throw the exception of browser startup failure.

Solution:- Change the way to create RemoteWebDriver.

  ClientConfig config = ClientConfig.defaultConfig().connectionTimeout(Duration.ofMinutes(20))
.readTimeout(Duration.ofMinutes(20)); // I change this 3 minute(Default) to 20 minutes.

WebDriver remoteWebDriver = RemoteWebDriver.builder().oneOf(caps).address(gridUrl).config(config).build(); // now you can use this remoteWebDriver.
like image 58
Saurabh Avatar answered Sep 22 '25 14:09

Saurabh


This error message...

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.

...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.

Your main issue possibly is the incompatibility between the version of the binaries you are using as follows:

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

Supports Chrome v67-69

  • You are using chrome= 68.0
  • Your Selenium Client version is unknown to us.
  • Your JDK version is unknown to us.

So there might be a mismatch between the JDK version , Selenium Client version , ChromeDriver v2.41 and the Chrome Browser v68.0


Solution

Ensure that:

  • JDK is upgraded to current levels JDK 8u222.
  • Selenium is upgraded to current levels Version 3.141.59.
  • ChromeDriver is updated to current ChromeDriver v78.0 level.
  • Chrome is updated to current Chrome Version 78.0 level. (as per ChromeDriver v78.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.
like image 26
undetected Selenium Avatar answered Sep 22 '25 14:09

undetected Selenium