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

会有一股神秘感。 提交于 2019-11-30 07:47:58

问题


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.


回答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.

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

  • You can find a relevant discussion in WebDriverException: Message: newSession with GeckoDriver Firefox v65 and Selenium through Python 3.7


来源:https://stackoverflow.com/questions/54824977/unreachablebrowserexception-could-not-start-a-new-session-possible-causes-are

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!