我正在尝试在日食上运行selenium程序,但我在这里构建.....它显示像这样

时间:2016-08-26 10:55:12

标签: java selenium

Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases
    at com.google.common.base.Preconditions.checkState(Preconditions.java:199)
    at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:109)
    at org.openqa.selenium.firefox.GeckoDriverService.access$100(GeckoDriverService.java:38)
    at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:91)
    at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296)
    at org.openqa.selenium.firefox.FirefoxDriver.createCommandExecutor(FirefoxDriver.java:245)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:220)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:215)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:124)
    at automationFramework.FirstTestCase1.main(FirstTestCase1.java:11)

1 个答案:

答案 0 :(得分:0)

您需要设置系统变量。

在驱动程序调用之前添加此项 System.setProperty(&#34; webdriver.gecko.driver&#34;,&#34;下载文件的路径&#34;);

文件可以从这里下载 https://github.com/mozilla/geckodriver/releases