2

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

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.

Moumita Das
  • 101
  • 2
  • 2
  • 9
  • 1
    Does this answer your question? [Selenium UnreachableBrowserException - "Could not start a new session" in SoapUI Groovy TestStep](https://stackoverflow.com/questions/30397043/selenium-unreachablebrowserexception-could-not-start-a-new-session-in-soapui) – anasmi Oct 30 '19 at 15:01
  • Check the browser version and the driver version you are using. Both should be compatible with the Selenium version. – Naveen Oct 30 '19 at 15:42

7 Answers7

1

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.
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
1

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.
Saurabh
  • 21
  • 1
  • 1
  • 3
1

For mac, there are 2 option for chrome driver chromedriver mac 1 or 2

  1. chromedriver_mac64.zip OR 2. chromedriver_mac64_m1.zip

Now, Go to file > Right click and "Open with terminal" > Provide required access. open in terminal Now, run command "mvn clean install" again, It works.

Ahmed
  • 11
  • 2
0

I have checked that the:

  • path is incorrect,
  • the path had .exe extension for mac driver
  • typo on the path, I had a comma instead of dot webdriver.chrome,driver

Lastly, it could be the compatibility issue but all worked fine after checking above items

Yasin Bekar
  • 127
  • 1
  • 4
0

Actually, the error is bit inappropriate. I too had the same issue but while using GRID and the problems were two.

  1. Selenium GRID / server version and the selenium lib used in code are different versions (4.9.0 and 4.8.3) Selenium server version img Selenium lib in code img

  2. Capability values were incorrect - Incorrect platform was chosen WIN10 instead of WIN11 DesiredCapabilities cap = new DesiredCapabilities(); cap.setPlatform(Platform.WIN10); cap.setBrowserName("chrome"); WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), cap);

0

I experienced a similar issue to this when I was using the image selenium/standalone-chrome:114.0 and explicitly setting the browser version in the Java code

ChromeOptions chromeOptions = new ChromeOptions();

chromeOptions.setBrowserVersion(browserVersion);

This was causing the issue whenever the browserVersion was malformed, which includes when the version was 114 without the trailing .0. The solution was to simply set the browser version to exactly 114.0.

MichaelM
  • 964
  • 7
  • 20
0

When ever you see error as following .... then that is mostly because of your dependencies mismatch. To avoid this please try to use latest versions of your dependencies

Error:

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.

Possible dependencies:

  • java-client
  • selenium-java [Note: selenium-java will have selenium-support so if your pom having both then you can remove selenium-support dependency from pom
  • selenium-support