【发布时间】:2017-03-16 10:51:21
【问题描述】:
我尝试下载新的 chrome 驱动程序并将其添加到我的驱动程序文件夹中,但它仍然抛出相同的错误。
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class gmail {
public static void main(String[] args) {
WebDriver driver = new ChromeDriver();
driver.get("https://mail.google.com");
driver.findElement(By.id("Email")).sendKeys("********");
driver.findElement(By.id("next")).click();
driver.findElement(By.id("Passwd")).sendKeys("********");
driver.findElement(By.id("signIn")).click();
}
}
Error displayed:
Exception in thread "main" java.lang.IllegalStateException: 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 at com.google.common.base.Preconditions.checkState(Preconditions.java:197)
【问题讨论】:
-
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
标签: java selenium selenium-webdriver selenium-chromedriver selenium-firefoxdriver