everydayrails/rails-4-1-rspec-3-0

Ch 8. Selenium Error

dxypher opened this issue · 1 comments

I was getting the following error after adding js: true to features/user_spec.rb

Selenium::WebDriver::Error::JavascriptError: arguments[0] is undefined

I was running Firefox 35. The solution was to uninstall Firefox 35 and install Firefox 34 instead.
After that the specs were passing again. I'm not sure why it doesn't work with 35.

I found the solution on StackOverflow, which also suggests disabling automatic updates of Firefox, otherwise it will update to 35 and the spec may fail again.

http://stackoverflow.com/questions/28159499/seleniumwebdrivererrorjavascripterror-arguments0-is-undefined

Yes, that's a drawback of using Selenium. The Selenium team is usually pretty good about releasing updates within a few days of new Firefox releases.

I like to use it to show newcomers what's happening in JS-dependent tests, but personally use Poltergeist and PhantomJS for development. I wrote a blog post about how to switch last week: http://everydayrails.com/2015/01/27/rspec-switch-selenium-poltergeist.html