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 UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
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)