我是硒自動化的新手,我已經遵循了網站的說明,并且使用了gecko驅動程序,但是它顯示以下消息。 64位),Selenium 3.12和gecko驅動程序20.1。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:847)這是我的代碼包裝自動化框架;導入org.openqa.selenium.WebDriver; 導入org.openqa.selenium.firefox.FirefoxDriver;公共類userLogin {public static void main(String[] args){ System.setProperty("webdriver.gecko.driver ","E:\\\\Selenium\\\\geckodriver-v0.21.0-win64\\\\geckodriver.exe"); WebDriver driver = new FirefoxDriver(); driver.get("https://www.facebook.com/");}
1 回答

蠱毒傳說
TA貢獻1895條經驗 獲得超3個贊
代替它
System.setProperty("webdriver.gecko.driver","E:\\\\Selenium\\\\geckodriver-v0.21.0-win64\\\\geckodriver.exe");
它有額外的空間...
添加回答
舉報
0/150
提交
取消