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

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

问题描述

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

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

执行程序时出现异常

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

Hub 和 Node 都是远程机器.

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)

推荐答案

这是您问题的答案:

正如您使用以下命令启动 Selenium Grid Hub:

As you have used the following command to start the Selenium Grid Hub:

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

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

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天全站免登陆