1

I am a beginner to testing. I want to launch Firefox browser. Can anyone explain me the error of below code?

package Script;

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

public class TestEbay_login {
    public static void main (String []arStrings) {
        System.setProperty("webdriver.gecko.driver", "C:\\Users\\Senani\\Downloads\\Programs\\geckodriver-v0.23.0-win64.exe");  
        WebDriver driver = new  FirefoxDriver();
        driver.get("https://www.google.com");
    }
}

Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: C:\Users\Senani\Downloads\Programs\geckodriver.exe

  • 2
    Just a guess, but it seems to me that the property only stores the directory path to the geckodriver and then always looks for geckodriver.exe. Now you have geckodriver-v0.23.0-win64.exe, so as a quick idea you can rename it to geckodriver.exe and see what happens. – Bence Kaulics Jan 2 at 14:49
  • Please also make sure all the files are extracted from zip and the path you are storing the driver executable is accessible by a program.\ – Kshetra Mohan Prusty Jan 2 at 18:45
2

Based on the error message the test is looking for ..\Downloads\Programs\geckodriver.exe while you have ..\Downloads\Programs\geckodriver-v0.23.0-win64.exe.

Renaming geckodriver-v0.23.0-win64.exe to geckodriver.exe should solve the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.