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

Posted . Visible to the public.

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
Last edit
License
Source code in this card is licensed under the MIT License.
Posted by Lexy to makandra dev (2012-05-10 12:36)