问题
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 ofOptions
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