org.openqa.selenium.SessionNotCreatedException:无法创建新服务:ChromeDriverService

时间:2019-05-03 06:06:14

标签: selenium grid

org.openqa.selenium.SessionNotCreatedException: Unable to create new service: ChromeDriverService

尝试过

System.setProperty("webdriver.chrome.driver",
         "E://Selenim Installations//Chrome
         Driver//chromedriver_win32//chromedriver.exe");


public void testGrid() throws MalformedURLException {

        DesiredCapabilities dc = new DesiredCapabilities().chrome();

        dc.setPlatform(Platform.WINDOWS);

        URL url = new URL("http://localhost:4444/wd/hub");
        // URL url = new URL("http://localhost:4444/wd/hub");

        WebDriver driver = new RemoteWebDriver(url, dc);

        driver.get("https://ui.freecrm.com/");

        System.out.println(driver.getTitle());


Expected: Driver should launch

实际:遇到错误

org.openqa.selenium.SessionNotCreatedException: Unable to create new service: ChromeDriverService
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'RISHI', ip: '192.168.0.5', os.name: 'Windows 8.1', os.arch: 'x86', os.version: '6.3', java.version: '1.8.0_201'
Driver info: driver.version: unknown
Command duration or timeout: 145 milliseconds

1 个答案:

答案 0 :(得分:0)

确保将chromedriver.exe设置为路径。

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);
相关问题