You might notice that Selenium’s rake acceptance test would fail the second time because Firefox restored tabs that belonged to the first time you ran the acceptance test.
If you run Selenium for the first time round, you’ll end with 2 tabs, the second one being the results:
When you run the test again, the first tab (circled in red) which was created in the previous session (also the first Selenium test), restored by Firefox, also runs a parallael Selenium test, resulting test failures:
The way to fix this is to disable session restore in Firefox’s about:config:
But what if you love Firefox’s session restore feature? Create a separate Firefox profile for Selenium testing!
Go to Terminal.app then enter this to run Firefox’s Profile Manager:
/Applications/Firefox.app/Contents/MacOS/firefox-bin -ProfileManager
Then modify /vendor/plugins/selenium-on-rails/lib/selenium-on-rails/acceptance_test_runner.rb:
Under the start_browser method, add a
-P Selenium
An example:
command = "\"#{path}\" -P Selenium \"http://#{HOST}:#{@port}#{TEST_RUNNER_URL}?test=tests&auto=true&baseUrl=#{base_url}&resultsUrl=postResults/#{log}&multiWindow=#{MULTI_WINDOW}\""
That would set Selenium to use Firefox with your newly created Selenium Profile, where you can turn off Session Restore just for that profile and still enjoy it in your default Firefox profile.








