I have tried the following three options . I am using C#

DesiredCapabilities capabilities = DesiredCapabilities.Chrome();
capabilities.SetCapability("chrome.binary", "pathtogooglechrome\chromedriver.exe");
_remoteWebDriver = new ScreenShotRemoteWebDriver(new Uri(""),


ChromeOptions options = new ChromeOptions();
options.BinaryLocation = "pathtogooglechrome\chromedriver.exe";
capabilities.SetCapability(ChromeOptions.Capability, options);
_remoteWebDriver = new ScreenShotRemoteWebDriver(new Uri(""),


System.Environment.SetEnvironmentVariable("webdriver.chrome.driver", "pathtogooglechrome\chromedriver.exe");
_remoteWebDriver = new RemoteWebDriver(new Uri(""),

After the SetEnviromentVariable if I try the following code I get path of the ChromeDriver.exe

string temp = System.Environment.GetEnvironmentVariable("webdriver.chrome.driver");

I always get the same error System.InvalidOperationException : The path to the driver executable must be set by the webdriver.chrome.driver system property I want to know what I'm doing wrong here, why path is not accepted?

If any alternative solution is available please let me know.

1 Answer 1


From documentation:

Gets or sets the location of the Chrome browser's binary executable file.

So the above excerpt plainly says that the BinaryLocation is the path for chrome.exe and not chromedriver.exe.

And chromedriver.exe path should be defined in the PATH environment variable.

So in your case the correct line would be:

options.BinaryLocation = @"pathtogooglechrome\chrome.exe"

Notice the @ in C# that will let you put un-escaped characters. Otherwise you would have needed \\ instead of \ etc.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.