Use a special version of Chrome for selenium (and another for your everyday work)

Sometimes you need a special version of chrome because it has some features you need for testing, like in this card. You do not need to use that Version apart from tests, because you can tweek selenium to use a special version that you set in your environment:

# features/support/chrome.rb
require "selenium/webdriver"

Capybara.register_driver :chrome320x480 do |app|
  
  if driver_path = ENV["CHROME_SELENIUM_BINARY_PATH"]
    Selenium::WebDriver::Chrome.path = driver_path
  end
  
  Capybara::Selenium::Driver.new(app, :browser => :chrome)
end

You can use this for tests with a special chrome versions as well, you can have several - see this card

Don't forget to set the environmet variable before running tests if you use the code above:

bash$ export CHROME_SELENIUM_BINARY_PATH='/Applications/ChromeBETAforTests.app/Contents/MacOS/Google Chrome'
bash$ cucumber
Christoph Beck About 12 years ago