简体   繁体   中英

I am trying to launch Mozilla but still I am getting this error

I am fresher in selenium and I am getting this error when I change my system. Please suggest me a solution for this. Thanks in advance.

Selenium - 3.4.0 Firebox browser - 47.0.2 Geckodriver - geckodriver-v0.16.1-win64

Exception in thread "main" java.lang.IllegalStateException: The driver executable is a directory: C:\Users\User\Downloads\geckodriver-v0.16.1-win64
    at com.google.common.base.Preconditions.checkState(Preconditions.java:518)
    at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:138)
    at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:131)
    at org.openqa.selenium.firefox.GeckoDriverService.access$100(GeckoDriverService.java:41)
    at org.openqa.selenium.firefox.GeckoDriverService$Builder.findDefaultExecutable(GeckoDriverService.java:115)
    at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:330)
    at org.openqa.selenium.firefox.FirefoxDriver.toExecutor(FirefoxDriver.java:207)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:108)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:104)
    at Facebook_listbox.main(Facebook_listbox.java:12)

You have to set the web driver. Try below:

System.setProperty("webdriver.gecko.driver", "Path to .exe");

WebDriver driver = new FirefoxDriver();

driver.get("http://seleniumhq.com");

You have to set the geckodriver file in the system property:

System.setProperty("webdriver.gecko.driver","path to geckodriver.exe");

Extract the file geckodriver-v0.16.1-win64.zip and set the path to the geckodriver.exe.

You are not entering path for geckdriver correctly. Extract the file downloaded for geckodriver and set path up to "geckodriver.exe" in extracted folder. Refer this one.

System.setProperty("webdriver.gecko.driver","G:\\Selenium\\Firefox driver\\geckodriver.exe");//set path as per location of your geckodriver

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM