Java – Setup Chrome WebDriver with remote ‘chromedriver.exe’ file

google-chromejavaseleniumselenium-chromedriverwebdriver

I have chrome installed in my system. I'm using Selenium to run some tests on chrome.

I have downloaded the Chromedriver.exe to MyDocuments. I have set the 'webdriver.chrome.driver' using System.setProperty() and started ChromeDriver(). It works fine.

System.setProperty("webdriver.chrome.driver", "C:\\MyDocuments\\chromedriver.exe");
driver=new ChromeDriver();

Now, I'm trying to put Chromedriver.exe in a remote machine 'https://remotemachine/chromedriver.exe'. When I set the System property and start ChromeDriver(), I'm getting an exception, where Selenium is searching for chrome in a strange path:

The webdriver.chrome.driver defined chromedriver executable does not
exist in C:\Users..\Appdata\Local\Google
Chrome\Application…\https://remotemachine/chromedriver.exe

Why is Selenium searching for the chromedriver.exe by appending the system property to some location in C drive ?

How to launch Chrome from Selenium using a remote chromedriver.exe file ?

Not related to above, but:

Is it also possible to find the default browser binary path using Java/Selenium ?

Best Answer

It expects chrome to be in this location in windows

%HOMEPATH%\AppData\Local\Google\Chrome\Application\chrome.exe

For remote it has to be either in path or the -Dwebdriver.chrome.driver value should be pointing to a local chromedriver.exe location.

Local as in local to the place it is being run.

Here is the link for setup: http://code.google.com/p/selenium/wiki/RemoteWebDriver http://code.google.com/p/selenium/wiki/ChromeDriver