0

So I have this c# console app that I'm creating.

It uses Selenium ChromeDriver to create WordPress menus. It's working perfectly on debug mode.

Now I release it and when I install the app, run it, it's giving me this error:

The chromedriver.exe file does not exist in the current t directory or in a directory on the PATH environment variable.

This is where I believe I'm getting this error:

ChromeOptions options = new ChromeOptions();
options.AddArgument("start-maximized");
driver = new ChromeDriver(options);

I've searched all over the internet but nothing seems to work, I think it's something that has to do with Publishing in Visual Studio.

3 Answers3

0

Copy chromedriver.exe from your Debug folder to your Release folder.

Merkle Groot
  • 846
  • 5
  • 9
  • Sounds like a nice one, I'll try it. –  Sep 02 '19 at 20:26
  • Riddell's answer should also work. It comes down to the same thing - Release runs from a different folder, and chromedriver.exe needs to be in that folder. – Merkle Groot Sep 02 '19 at 20:41
  • I don't know much about the release, but I'm glad it's working! –  Sep 02 '19 at 23:22
0

Presuming you have installed the NuGet package Selenium.WebDriver.ChromeDriver. You will find the latest chrome driver in \Selenium.WebDriver.ChromeDriver\driver\win32\chromedriver.exe select the correct version based on system.

Add the file to your project, then in the file properties select under "Copy to Output Directory" either "Copy Always" or "Copy if Newer".

This question should help

Selenium WebDriver.ChromeDriver Nuget package installed, but not working for MSTest

Riddell
  • 1,429
  • 11
  • 22
0

From the project owner github page:

"chromedriver(.exe) isn't included in published files on default configuration. This behavior is by design."

If you want to include "chromedriver(.exe)" into published files, please define "_PUBLISH_CHROMEDRIVER" compilation symbol (Under Project > Properties > Build)

enter image description here

Troy
  • 175
  • 2
  • 11