deepak mishra
deepak mishra

Reputation: 310

UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server with Selenium Grid

Error in opening new driver window:

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.

server log:

Forwarding newSession on session null to remote

I am running following code on linux:

driver= new RemoteWebDriver((new URL( "http://"+ip+":5555/wd/hub")), capability);

My hub-node already up and running. Then why i am getting this error.

Upvotes: 4

Views: 1879

Answers (1)

undetected Selenium
undetected Selenium

Reputation: 193058

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.

and the server log...

Forwarding newSession on session null to remote

...implies that the Selenium Grid Hub / Selenium Grid Node wasn't properly initiated/started. As a result a null session was forwarded to the RemoteWebDriver.


Some more information regarding the versions of the binaries which you have used interms of Selenium server/client, WebDriver variant /version and WebBrowser variant /version and the commands you have used to initiate the Selenium Grid Hub / Selenium Grid Node would have helped us to debug your issue in a easier way.

However this issue can happen due to multiple factors as follows:

  • You are using the uri 5555/wd/hub, so ensure that Selenium Grid Hub is initiated on port 5555.
  • You may opt to replace the capability argument with an instance of Options class as follows:

    DesiredCapabilities caps = new DesiredCapabilities();
    caps.setCapability("browser", "chrome");
    //seting the required capabilities
    ChromeOptions options = new ChromeOptions();
    options.merge(caps);
    WebDriver driver = new RemoteWebDriver((new URL( "http://"+ip+":5555/wd/hub")), options);        
    
  • You can find a relevant discussion in Remote WebDriver UnreachableBrowserException: Could not start a new session

  • This issue is frequently observed with GeckoDriver/Selenium/Mozilla due to version mismatch of the binaries you are using. As a thumb rule always follow the configuration matrix from the GeckoDriver, Selenium and Firefox Browser compatibility chart

supported_platforms_geckodriver_24

Upvotes: 2

Related Questions