ChromeDriver does not exist in Selenium WebDriver C# test script

Highstead picture Highstead · Feb 1, 2012 · Viewed 86.4k times · Source

I have come across a few people with the same issue that seemed to have solved the problem with System.addProperty("webdriver.chrome.driver", ".../chromedriver.exe"); before instantiating the driver.

I have had little luck with this and am still getting the error that the file .../bin/Debug/chromedriver.exe does not exist.

Has anyone had any luck getting this to run without putting it in the bin folder?

Example code:

System.Environment.SetEnvironmentVariable("webdriver.chrome.driver", @"c:\path\to\driver\chromedriver.exe");
BrowserDriver = new ChromeDriver();

Answer

JimEvans picture JimEvans · Feb 2, 2012

Since you're using C#, you should use the constructor overload for ChromeDriver that allows you to specify the path to the directory containing chromedriver.exe. To wit:

IWebDriver driver = new ChromeDriver(@"C:\my\path\to\chromedriver\directory");