Yulia Yulia - 1 year ago 173
Ruby Question

How to build remote Webdriver for Chrome

I am trying to run my Selenium tests against Chrome. When I initialize driver locally:

@driver = Selenium::WebDriver.for( :chrome )

Everything works fine (I already put Chrome binary on my PATH)
But when I try to launch it remotely:

@driver = Selenium::WebDriver.for(:remote, :url => 'http://' + SELENIUM_HOST + port + webdriver_hub, :desired_capabilities => :chrome)

I get the following error

Selenium::WebDriver::Error::UnhandledError: The path to the
chromedriver executable must be set by the webdriver.chrome.driver
system property; for more information, see
http://code.google.com/p/selenium/wiki/ChromeDriver. The latest
version can be downloaded from

I am a bit confused there - how exactly should I set this system property? I found this code written in Java:

DesiredCapabilities caps = DesiredCapabilities.chrome();
caps.setCapability("chrome.binary", "/path/to/where/chrome/is/installed/chrome.exe");
ChromeDriver driver = new ChromeDriver(caps);

but my tests are written in Ruby. RubyBindings don't talk about this issue http://code.google.com/p/selenium/wiki/RubyBindings

Answer Source

Actually the error message is slightly wrong. You don't have to set the system property, but the chromedriver executable needs to be available in the PATH on the remote machine (where the server is running).

If you want to specify the path as a property, you can do that when you launch the server, e.g.:

java -Dwebdriver.chrome.driver=/path/to/driver -jar selenium-server-standalone.jar
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download