Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tjh/5113339 to your computer and use it in GitHub Desktop.
Save tjh/5113339 to your computer and use it in GitHub Desktop.

Motivation

We recently were working on a project where the version of Firefox on the development machines was causing acceptance tests running on Capybara and Selenium to fail and/or hang erroneously. The solution was to point Selenium at a custom version of Firefox. We also added the Firefox binaries to the application git repo so that all devs could run against a known good version of Firefox.

Solution

  1. Download the desired version of Firefox from ftp://ftp.mozilla.org/pub/firefox/releases/

  2. Put Firefox.app in your rails app somewhere like ./bin/spec/macosx/

  3. Add an intializer called selenium.rb to config/initalizers and put in the following code (customized to where you put Firefox)

if Rails.env.test?
    require 'selenium-webdriver'
    Selenium::WebDriver::Firefox::Binary.path= Rails.root.to_s + '/bin/spec/macosx/Firefox.app/Contents/MacOS/firefox-bin'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment