Java Selenium Chrome Web驱动程序异常

Java Selenium Chrome Web驱动程序异常,java,google-chrome,selenium,selenium-chromedriver,Java,Google Chrome,Selenium,Selenium Chromedriver,我正在尝试用Java获取webdriver实例。我在后台运行selenium org.openqa.selenium.WebDriverException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/Chr

我正在尝试用Java获取webdriver实例。我在后台运行selenium

    org.openqa.selenium.WebDriverException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html
Command duration or timeout: 121 milliseconds
Build info: version: '2.46.0', revision: '87c69e2', time: '2015-06-04 16:16:47'
System info: host: 'ARMac.home', ip: '192.168.1.5', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.3', java.version: '1.8.0_11'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
我的代码如下所示

    System.setProperty("webdriver.chrome.driver", System.getProperty("user.home") + "/chromedriver");
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
    desiredCapabilities.setJavascriptEnabled(true);
    desiredCapabilities.setCapability("takesScreenshot", true);

     String link = "http://www.google.com";
    WebDriver driver = new RemoteWebDriver(new URL(
            "http://127.0.0.1:4444/wd/hub"), desiredCapabilities);
我运行Selenium的方式是

java -jar selenium-server-standalone-2.46.0.jar -timeout=20

将chrome webdriver位置添加到java调用:

java-jar selenium-server-standalone-2.46.0.jar-timeout=20-Dwebdriver.chrome.driver=C:\path to\chromedriver.exe

如果您决定同时使用IE驱动程序,则需要添加它,如:

-Dwebdriver.ie.driver=C:\IEDriverServer.exe的路径