当前位置: 首页 > 知识库问答 >
问题:

我试图在eclipse上运行selenium程序,但我在这里构建了。。。。。它是这样显示的[重复]

丁雅懿
2023-03-14
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个答案

孔建柏
2023-03-14

你需要设置系统变量。

在驾驶员呼叫系统之前添加此选项。setProperty(“webdriver.gecko.driver”,“下载文件的路径”);

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

 类似资料: