Capybara + Selenium + RSpec — LoadError when setting JS to true Capybara + Selenium + RSpec — LoadError when setting JS to true selenium selenium

Capybara + Selenium + RSpec — LoadError when setting JS to true


i had the same issue now for 3 days! it was driving me nuts!

short answer: downgrade selenium-webdriver to 2.21.1

long explanation:after some digging into the source code i can verify the issue is selenium-webdriver 2.21.2 inside a Rails app (i test on rails 3.0.x personally).

the offending line of code can be found here http://code.google.com/p/selenium/source/browse/trunk/rb/lib/selenium/webdriver.rb?r=16651#78

the root cause is in a Rails app the class ActiveSupport::Dependencies::Loadable defines a class level method called load on Object, therefore the check MultiJson.respond_to?(:load) always returns true but its the wrong load method.


This can also be worked around by upgrading multi_json to the latest version.


I was having the same problem, the solution for me was change the drive that I was using.So for example:

scenario "answering the quiz for my recipient", :js => true, :driver => :rack_test do    click_button "Continue"end

This way I'm using the rack_test instead of the selenium-webdrive ( the default of Capybara ).

Hope this help you!