-2

Getting the following error

Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: /Users/Golcha/Desktop/Automation/geckodriver.exe

Code:

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

public class selenium{

    private static WebDriver driver;

    public static void main(String[]args){

        System.setProperty("webdriver.gecko.driver","Users/Golcha/Desktop/Automation/geckodriver.exe");

        setDriver(new FirefoxDriver());
    }

    public static WebDriver getDriver() {
        return driver;
    }

    public static void setDriver(WebDriver driver) {
        selenium.driver = driver;
    }

}
Alok
  • 1,441
  • 4
  • 20
  • 31
Bandana Singh
  • 95
  • 1
  • 4
  • 10

3 Answers3

1

Try below code but check the path of geckodriver properly before executing the below code or I ll suggest you to paste geckodriver in C drive or any other drives to make your path simple as below one :

System.setProperty("webdriver.firefox.marionette", "C:\\geckodriver.exe");  

It should work without any problem . All the best !

whatsinthename
  • 1,828
  • 20
  • 59
0

I thing you have not mentioned the complete(full) path for the Geckodriver in your System.setProperty() method. you have missed the drive letter "C"

"C:/Users/Golcha/Desktop/Automation/geckodriver.exe"

Let me know if this solved your problem.

Alok
  • 1,441
  • 4
  • 20
  • 31
0

I had a similar problem but weirdly I was not able to execute the selenium script on both my drivers (chrome and firefox), I tried checking my setProperty method, my gecko driver path and chrome driver path. Lastly, I tried updating both my browser and it seems to be working now. (my current version of Chrome is 66 and my current version of my Firefox is 56.0).

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
guest
  • 1