Windows – Setting Chrome Driver path in eclipse and system variable in windows to execute on MAC

cross-browserremotewebdriverseleniumselenium-chromedriverwindows

I have one requirement of running automation scripts on chrome – Mac machine

All my automation code base is on windows 7

I have created selenium grid node on mac downloading chrome driver on mac and configured targeted mac url in the test scripts.

Next step that followed is adding System.setProperty("webdriver.chrome.driver" ..) downloading chrome driver in windows machine and setting the path as
System.setProperty("webdriver.chrome.driver", "C://Users//nandhsri//MyWork//SeleniumJars//chromedriver");

But it failed to execute test scripts from windows to run on mac and displayed the following error :
Caused by: org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
(Driver info: chromedriver=2.9.248307,platform=Mac OS X 10.8.5 x86_64)

And also tried downloading chrome driver in MAC machine and setting the path as
System.setProperty("webdriver.chrome.driver", "\Users\admin\Downloads\chromedriver");

but it displayed the same error ..

Is that I am missing any thing ..

Can any one help in this chrome driver grid setup to run remotely on mac from windows machine

Best Answer

Mac uses forward slash instead of backward slashes. To get around this in Java try this:

System.setProperty("webdriver.chrome.driver", File.separator + "Users" + File.separator + "admin"+File.separator + "Downloads" + File.separator + "chromedriver");