打开新驱动程序窗口时出错:
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.
服务器日志:
Forwarding newSession on session null to remote
我在 linux 上运行以下代码:
driver= new RemoteWebDriver((new URL( "http://"+ip+":5555/wd/hub")), capability);
我的中心节点已经启动并运行。那为什么我会收到此错误。
最佳答案
这个错误信息...
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.
和服务器日志...
Forwarding newSession on session null to remote
...暗示 Selenium Grid Hub/Selenium Grid Node 未正确启动/启动。结果是
null session
被转发到 RemoteWebDriver。关于您使用的二进制文件版本的更多信息,如 Selenium 服务器/客户端、WebDriver 变体/version 和 WebBrowser 变体/version 以及您用于启动 Selenium Grid Hub/Selenium Grid Node 的命令将有助于我们以更简单的方式调试您的问题。
但是,由于以下多种因素,可能会发生此问题:
5555/wd/hub
,因此请确保在端口 上启动 Selenium Grid Hub 5555 . capability
带有 Options
实例的参数类如下: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);
关于selenium - UnreachableBrowserException : Could not start a new session. 可能的原因是使用 Selenium Grid 的远程服务器的地址无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54824977/