Yulia Yulia - 4 days ago 5
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
http://code.google.com/p/chromium/downloads/list
(java.lang.IllegalStateException)


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.setJavascriptEnabled(true);
caps.setCapability("chrome.binary", "/path/to/where/chrome/is/installed/chrome.exe");
System.setProperty("webdriver.chrome.driver","/path/to/where/you/ve/put/chromedriver.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

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
Comments