Read more

Run Selenium tests in Chrome instead of Firefox

Henning Koch
July 05, 2011Software engineer at makandra GmbH

Here is how to switch your Selenium to Chrome:

  1. Make sure you've got a recent version of chromedriver Show archive.org snapshot in your $PATH
Illustration online protection

Rails professionals since 2007

Our laser focus on a single technology has made us a leader in this space. Need help?

  • We build a solid first version of your product
  • We train your development team
  • We rescue your project in trouble
Read more Show archive.org snapshot

See also geordi chromedriver_update Show archive.org snapshot which is automatically executed before every usage of geordi cucumber.

  1. Register Driver:

Create a file features/support/capybara.rb with the following content for recent version of Capybara:

Capybara.register_driver :selenium do |app|
  Capybara::Selenium::Driver.new(app, browser: :chrome)
end

Legacy Capybara setup

If you have an older Capybara version you need to say:

Capybara.javascript_driver = :selenium

Capybara::Driver::Selenium.class_eval do
  cattr_accessor :driver
end

driver = Selenium::WebDriver.for :chrome

Capybara::Driver::Selenium.driver = driver

at_exit do
  driver.close
end
Posted by Henning Koch to makandra dev (2011-07-05 11:50)