RemoteWebDriver throws “org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session”

左心房为你撑大大i 提交于 2019-11-28 10:43:29

问题


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 driver path which I have mentioned is a share path that can be accessible from the node machine.

  • Chrome Version: 58.0.3029.110
  • Chrome Driver Version: 2.9

Both Hub and Node are remote machines.

Below is the code used:

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");

}

Below is the console message:

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)

回答1:


Here is the Answer to your Question:

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

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

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.



来源:https://stackoverflow.com/questions/45096815/remotewebdriver-throws-org-openqa-selenium-sessionnotcreatedexception-unable-t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!