Reputation: 31
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:
I have added the selenium binary as a system variable, as shown below:
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
Upvotes: 3
Views: 2249
Reputation: 4173
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.
Upvotes: 1