Unable to create new Chrome remote session

前端 未结 3 1896
自闭症患者
自闭症患者 2021-01-22 03:19

I\'m trying to launch a new Chrome browser using Selenium Grid but ending up with the below error

Unable to create new remote session. desired capabilities = Capabilitie

相关标签:
3条回答
  • 2021-01-22 03:50

    make sure your code is able to find the chromedriver in your system. You can set the path programatically, you can even download and keep your driver from the below link

    System.setProperty("webdriver.chrome.driver","/path to/chromedriver.exe");
    cap = DesiredCapabilities.chrome();
    cap.setPlatform(org.openqa.selenium.Platform.WINDOWS);
    browser = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),cap);
    
    0 讨论(0)
  • 2021-01-22 04:01

    The line java -Dwebdriver.chrome.driver=C:\chromedriver.exe -jar selenium-server-standalone-3.0.1.jar -role node causes a plain vanilla node to be spun off which is agnostic of PLATFORM flavors (i.e., the node is not classified to recognize platform as a trait and is supposed to work as a generic node).

    Your test code however seems to be specifying the platform as below

    cap = DesiredCapabilities.chrome();
    cap.setVersion("55.0.2");
    cap.setBrowserName("chrome");
    cap.setPlatform(org.openqa.selenium.Platform.WINDOWS);
    

    To fix your problem please change your test code to look like below

    cap = DesiredCapabilities.chrome(); // this sets the browser name. u dont need to do it again.
    browser = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"),cap);
    

    Once you have this, you should be able to execute tests properly.

    Please dont forget to add the location to where your chromedriver binary exists to your PATH variable before starting the node, so that you dont see issues related to selenium not being able to find the chromedriver's location.

    For general overview on working with Grid, you can refer to my blog post

    0 讨论(0)
  • 2021-01-22 04:03

    I encounter the same and i found that the platform, browser name & browser version details were not matching the grid configuration. Specifically it was because i was using platrom as windows where i would have used VISTA. Also make sure you are using the hub URL instead of the node URL.Hub URL would be http://hubIP:port/wd/hub.

    Refer below screenshot to get the right details about the node:

    0 讨论(0)
提交回复
热议问题