UnreachableBrowserException:无法开始新的会话.可能的原因是带有Selenium Grid的远程服务器的地址无效 [英] 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.
服务器日志:
Forwarding newSession on session null to remote
我正在linux上运行以下代码:
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.
推荐答案
此错误消息...
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 .
...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.
有关您在 Selenium 服务器/客户端, WebDriver 变体/version和 WebBrowser 中使用的二进制文件版本的更多信息变体/version以及用于启动 Selenium Grid Hub / Selenium Grid Node 的命令将帮助我们以一种更简单的方式调试问题.
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:
- 您正在使用 uri
5555/wd/hub
,因此请确保在端口 5555 上启动了 Selenium Grid Hub . -
您可以选择将
capability
参数替换为Options
类的实例,如下所示:
- 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);
这篇关于UnreachableBrowserException:无法开始新的会话.可能的原因是带有Selenium Grid的远程服务器的地址无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!