Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The path to the driver executable must be set by the webdriver.chrome.driver system property - Selenium Error

I have an infuriating Selenium error:

The path to the driver executable must be set by the webdriver.chrome.driver system property

Here is the code I am using:

Environment.SetEnvironmentVariable("webdriver.chrome.driver", @"C:\ChromeDriver\chromedriver.exe");

DesiredCapabilities capability = DesiredCapabilities.Chrome();

ChromeOptions options = new ChromeOptions();
options.BinaryLocation = @"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe";
capability.SetCapability(ChromeOptions.Capability, options);

Uri url = new Uri("http://localhost:5050/wd/hub");

//error on this line
IWebDriver driver = new RemoteWebDriver(url, capability);

I have the driver on disk, at the location.

The selenium server is running, as shown below:

Server

I have added the selenium binary as a system variable, as shown below:

Variables

I have restarted the server too.

What am I missing? It feels as though I am doing everything correctly, but it's not working.

Thanks

like image 607
J. Doe Avatar asked Jan 31 '26 06:01

J. Doe


1 Answers

With the new selenium, which is 3.0 you should use:

java -Dwebdriver.chrome.driver=path_to_chrome_driver -jar selenium-server-standalone-3.0.0-beta2.jar

If you are using selenium version below 3.0 you need to reverse the order of selenium with the driver, like:

java -Dwebdriver.chrome.driver=path_to_chrome_driver -jar selenium_server.jar

Also make sure selenium server is compatible with chromedriver. Other thing to check is that chrome browser is up to date.

like image 58
lauda Avatar answered Feb 02 '26 19:02

lauda



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!