RemoteWebDriver引发"org.openqa.selenium.SessionNotCreatedException:无法创建新的远程会话". [英] RemoteWebDriver throws "org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session"

查看:166
本文介绍了RemoteWebDriver引发"org.openqa.selenium.SessionNotCreatedException:无法创建新的远程会话".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从集线器到节点运行一个简单的代码,集线器和节点连接成功.

I'am trying to run a simple code from hub to node, hub and node connections are successful.

在执行程序时我遇到了异常

While executing the program I am getting the exception

org.openqa.selenium.SessionNotCreatedException

我提到的Chrome驱动程序路径是可以从节点计算机访问的共享路径.

Chrome driver path which I have mentioned is a share path that can be accessible from the node machine.

  • Chrome版本:58.0.3029.110
  • Chrome驱动程序版本:2.9

集线器和节点都是远程计算机.

Both Hub and Node are remote machines.

下面是使用的代码:

public static void main(String[] args) throws MalformedURLException {

    WebDriver driver;
    System.setProperty("webdriver.chrome.driver", "Q:\\xxxxx\\chromedriver.exe");
    DesiredCapabilities dc = new DesiredCapabilities();
    dc.setBrowserName("chrome");
    dc.setPlatform(Platform.VISTA);
    driver = new RemoteWebDriver(new URL("http://10.xx.xxx.xx:5566/wd/hub"), dc); //node url
    driver.get("https://www.google.com");

}

以下是控制台消息:

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{browserName=chrome, platform=VISTA}], required capabilities = Capabilities [{}]
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: host: 'A5DAFC-W7A-0012', ip: '10.xx.xxx.xx', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_131'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:91)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:155)
    at testcases.Grid.main(Grid.java:23)

推荐答案

以下是您的问题的答案:

Here is the Answer to your Question:

使用以下命令来启动 Selenium Grid Hub :

 java -jar selenium-server-standalone-3.4.0.jar -role hub -port 4123

要通过chromedriver.exeGoogle Chrome浏览器执行代码块,您可以考虑通过以下命令在端口 5566 上启动 Selenium Grid Node :

To execute your code block through chromedriver.exe and Google Chrome Browser you can consider to start the Selenium Grid Node on port 5566 through this command:

java -Dwebdriver.chrome.driver=chromedriver.exe -jar selenium-server-standalone-3.4.0.jar -role node -hub http://localhost:4123/grid/register -port 5566

通过 <IP_of_GridHub>:4123/grid/console 访问Selenium Grid Hub控制台以查看正在注册的节点.

Access the Selenium Grid Hub Console through <IP_of_GridHub>:4123/grid/console to see the Node being registered.

让我知道这是否回答了您的问题.

Let me know if this Answers your Question.

这篇关于RemoteWebDriver引发"org.openqa.selenium.SessionNotCreatedException:无法创建新的远程会话".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆