Unable to create new Chrome remote session

前端 未结 3 1929
自闭症患者
自闭症患者 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 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

提交回复
热议问题