How to set up selenium 3.0, getting error "The geckodriver.exe file does not exist..." in c#
From selenium 3.0, you have to use the geckodriver
for Firefox browser.
download the latest geckodriver from here https://github.com/mozilla/geckodriver/releases
You have two options:
- enter geckodriver path in Windows System Environment Variable
PATH
. - Or specify the location of the geckodriver.exe programmatically as follows.
System.Environment.SetEnvironmentVariable("webdriver.gecko.driver",@"/path/to/geckodriver.exe"
Note: System restart may be required if you set PATH environment variable.
From Firefox 47 onwards (Excluding it), Selenium uses geckodriver capabilities by default. For 47 and previous versions onwards, you may need to turn off this capability so that Selenium can use Firefox built-in support like we used to work with these versions.
JAVA version to achieve the same:
DesiredCapabilities d = new DesiredCapabilities();
d.setCapability("marionette", false); // to disable marionette.
WebDriver driver = new FirefoxDriver(d);
References:
- how to set system properties in C#
- https://msdn.microsoft.com/en-us/library/z46c489x.aspx
- https://superuser.com/questions/317631/setting-path-in-windows-7-command-prompt
- https://stackoverflow.com/a/40466109/2575259