无法创建新服务:Selenium独立服务器中的ChromeDriverService错误

时间:2018-06-29 16:52:07

标签: java selenium server webdriver

我正在尝试执行附带的代码并收到以下错误,

  

线程“主”中的异常   org.openqa.selenium.SessionNotCreatedException:无法创建新的   服务:ChromeDriverService构建信息:版本:'3.12.0',修订版:   '7c6e0b3',时间:'2018-05-08T15:15:08.936Z'系统信息:主机:'OHM',   ip:'xxx.xxx.x.xxx',操作系统名称:'Windows 8.1',os.arch:'amd64',   os.version:'6.3',java.version:'1.8.0_151'驱动程序信息:   driver.version:未知

package com.pluralsight;

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

public class RemoteWebDriverDemo {

public static void main(String[] args) throws Exception
{

    System.setProperty("webdriver.chrome.driver", 
"E:\\Selenium\\Chrome_driver\\chromedriver.exe");
    WebDriver driver = new RemoteWebDriver(new 
URL("http://localhost:4444/wd/hub"), 
            DesiredCapabilities.chrome());
String baseUrl = "http://GOOGLE.com";

    //WebDriver driver = new ChromeDriver();

    driver.get(baseUrl + "/");

    WebElement searchBox = driver.findElement(By.id("lst-ib"));
    searchBox.sendKeys("Lord Krishna");
    searchBox.submit();

    WebElement imagesLink = 
driver.findElements(By.linkText("Images")).get(0);
    imagesLink.click();


    }

}

0 个答案:

没有答案