-1

I apologize if this was answered already, but I could not find any posts that address my problem specifically. I'm a beginner at this.

The following is my code:

package com.pluralsight;

import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.WebDriver;

public class WebDriverTutorial {

    public static void main(String[] args) {
        // TODO Auto-generated method stub

        System.setProperty("webdriver.gecko.driver", "C:\\Users\\ALiLLiNOiS\\Desktop\\eclipse-java-oxygen-3a-win32-x86_64");

        WebDriver driver = new FirefoxDriver();
        driver.get("http://www.pluralsight.com");
    }

}

And here is the error:

Exception in thread "main" java.lang.IllegalStateException: The driver executable is a directory: C:\Users\ALiLLiNOiS\Desktop\eclipse-java-oxygen-3a-win32-x86_64
    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 com.pluralsight.WebDriverTutorial.main(WebDriverTutorial.java:13)
Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268
A-L
  • 9
  • 4
  • What is your question? – Code-Apprentice Feb 21 '19 at 00:04
  • I can't launch firefox because of the error above. I have downloaded geckodriver and wrote out the code correctly. However, I am getting the error above – A-L Feb 21 '19 at 00:09
  • `C:\\Users\\ALiLLiNOiS\\Desktop\\eclipse-java-oxygen-3a-win32-x86_64` does not say `geckodriver.exe` anywhere. where did you get this? – SiKing Feb 21 '19 at 00:13
  • I downloaded it from the github link where all of the releases are. I tried extracting it but the exe never showed up – A-L Feb 21 '19 at 00:16
  • https://github.com/mozilla/geckodriver/releases – A-L Feb 21 '19 at 00:18
  • "I tried extracting it but the exe never showed up" You need to figure out this step before you can fix the code. The exe file is required for your code to run correctly. – Code-Apprentice Feb 21 '19 at 00:36
  • Any suggestions as to how to fix it? I downloaded the driver, right clicked and selected extract all and went through the whole shebang. – A-L Feb 21 '19 at 00:59

2 Answers2

0

You need to download geckodriver and set "webdriver.gecko.driver" to the full path for that file.

Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268
0

Please compare this:

System.setProperty("webdriver.gecko.driver", "D:\\xyz\\Selenium\\geckodriver\\geckodriver.exe");

Please download the gecko driver for same platform. below provided the link: https://github.com/mozilla/geckodriver/releases

Suggestion 1: Select as per your platform Example: Download only Win64 for Windows 64bit platform. Suggestion 2: If after extracting your file not reflect then some security issue have or your antivirus delete the .exe file after extracting.