0

when i'm running the selenium test from VS2017 it is able to pick the drivers successfully BUT when i run the same test using mstest command - internally it is referring some other directory!

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\mstest.exe/ testcontainer:..\Test\Sun.TestAutomation.dll /test:"myfristtest" /resultsfile:..\Test\TestResultLog.trx //Mstest commands

OpenQA.Selenium.DriverServiceNotFoundException: OpenQA.Selenium.DriverServiceNotFoundException: The file C:\Test\xsed_2018-12-07 10_55_51\Out\chromedriver.exe does not exist. The driver can be downloaded at http://chromedriver.storage.googleapis.com/index.html.

code:

this.DriversPath = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory()));

additional information:

drivers are available in debug folder why my mstest is referring the drivers in "Out" folder ??

1
  • Now I have a new question: Which framework are you targeting .Net Standard or .Net Framework? Commented Dec 12, 2018 at 22:05

2 Answers 2

1

This post is a bit old but since it was brought back to the the front, this may help someone.

  1. I would download the ChromeDriver Nuget package. This way you always get the latest version.

  2. Right click on your project > properties. Click on Build tab.

  3. set Conditional compilation symbols = _PUBLISH_CHROMEDRIVER

  4. under output path set: bin\Debug\

Once installed, clean solution and rebuild and you should see the file in the bin dir.

for your chromedriver call it should look something like this:

Driver = new ChromeDriver(Path.Combine(GetBasePath, @"bin\debug"), options);

Then add the GetBasePath code:

  public static string GetBasePath
    {
        get
        {
            var basePath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            basePath = basePath?.Substring(0, basePath.Length - 10);
            return basePath;
        }
    }
Sign up to request clarification or add additional context in comments.

Comments

0

This PC -> Properties -> advanced system settings -> Environment variables -> system variables -> Varible PATH add folder, where you have chromedriver.exe

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.