I have added the WebDriver.ChromeDriver nuget package to my solution, which contains the ChromeDriver.exe file, required for Selenium WebDriver to run automated tests using
The Nuget package will place the driver.exe file in {buildconfiguration}/ To tell it to look in the root of the application, pass a "." when creating a new instance of the driver.
IWebDriver driver = new ChromeDriver(".");
I set it to "Copy", which always which resulted in error when I try to rebuild it. Setting it to "Copy if newer" works fine.
its resolves the issue :
IWebDriver driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
IWebDriver driver = new ChromeDriver("C:\\Folder_with_Chrome_driver");
Download related driver and add local path.
I wouldn't bother with the NuGet package for this, simply because this is not a class library - which is technically, what NuGet is all about. ChromeDriver has also been updated many times since that release.
Anyway, I would say that I have just done the same thing to see what the issue is:
You are probably falling down on point 4. That setting is set to Do not copy by default.
I had similar problem solved it by these 3 steps
1.Goto google chrome drivers official site https://sites.google.com/a/chromium.org/chromedriver/downloads download and unpack
2.Goto Visual Studio solution explorer click add -> existing file -> select chrome driver
3.Right click on chrome driver in VS and select properties set it to always copy