51

Today running my rspec tests, I get the following error whenever somewhere in a test theres a `page.execute_script' call.

 Selenium::WebDriver::Error::JavascriptError:
   waiting for evaluate.js load failed
 # [remote server] file:///tmp/webdriver-profile20130807-3105-fpynb7/extensions/fxdriver@googlecode.com/components/driver_component.js:8360:in `r'
 # [remote server] file:///tmp/webdriver-profile20130807-3105-fpynb7/extensions/fxdriver@googlecode.com/components/driver_component.js:392:in `fxdriver.Timer.prototype.runWhenTrue/g'
 # [remote server] file:///tmp/webdriver-profile20130807-3105-fpynb7/extensions/fxdriver@googlecode.com/components/driver_component.js:386:in `fxdriver.Timer.prototype.setTimeout/<.notify'

There is a file evaluate.js in the /resources directory (instead of components) of the path above, as it is on other machines.

This happened after updating to Firefox 23 from 22. I haven't been able to rollback yet to confirm that returning to 22 indeed fixes the problem, but that's all that's changed I believe.

Has anyone else seen this problem?

Running Kubuntu 12.04, Capybara 1.1.4, selenium-webdriver gem 2.33.0

I tried updating Capybara to 2.whatever and selenium-webdriver to 2.34.0, no change.

Hsiu Dai
  • 1,303
  • 2
  • 14
  • 21

4 Answers4

85

I had the same problem on Mac OS X Lion with FF 23.

But the problem went away for me when I updated selenium-webdriver to 2.34.0

I added gem "selenium-webdriver", "~> 2.34.0" into my Gemfile.

bundle update selenium-webdriver

bundle install

Cucumber works fine with selenium now.

Jason Kim
  • 18,102
  • 13
  • 66
  • 105
  • Oooookay, I swear I did that before, but now it's working. Maybe I forgot to `install`, who knows. Anyways, fixed my problem so enjoy your accept, thanks! – Hsiu Dai Aug 07 '13 at 23:35
  • 1
    Was seeing the same in a TestNG test. Simply removed the selenium-java-2.33.0.jar and replaced it with the selenium-java-2.34.0.jar. – Sakamoto Kazuma Aug 14 '13 at 17:02
  • When using Spork don't forget to stop and restart the server so it takes changes. – marman Sep 03 '13 at 22:01
  • I get "LoadError: cannot load such file -- zip/zip" – defvol Sep 04 '13 at 21:31
  • 2
    You can fix the rubyzip issue with this: http://stackoverflow.com/questions/18555992/bundle-exec-rspec-spec-requests-static-pages-spec-rb-from-hartls-tutorial-isnt – defvol Sep 04 '13 at 21:41
  • OK, but then when I run cucumber, I get "cannot load such file -- zip/zip (LoadError)" and a stack trace. – nroose Oct 02 '13 at 17:59
4

I have updated my gems to:

gem 'capybara',             '~> 2.1.0'
gem 'selenium-webdriver',   '~> 2.35.1'

This worked for me.

Update:

Capybara 2.1.0 has given me a problem with Phantomjs and finally I use 2.0.3 version.

rjurado01
  • 5,337
  • 3
  • 36
  • 45
  • This one works for me on Ubuntu 12.04LTS, when using Spork don't forget to stop and restart the server so it takes changes. – marman Sep 03 '13 at 22:02
1

I ran the below and it worked :

 gem install selenium-webdriver -v "2.35.0"
Arup Rakshit
  • 116,827
  • 30
  • 260
  • 317
0

I installed Selenium Webdriver recently and saw this same issue with some of my Python test scripts. After some digging I was able to determine that execute_script was hanging when it attempted to convert the JS return value into an object that could be natively evaluated (in Python for my scenario).

Would hang:

self.driver.execute_script('document.body.innerHTML="<form></form>";')

Wouldn't hang:

self.driver.execute_script('document.body.innerHTML="<form></form>"; return true;')

You can still return more complicated objects, I'm just careful to always explicitly have JS return the value I want or true if I just need the script to execute.

Hope this helps.

Some of the reading I did to figure this out:

Community
  • 1
  • 1
Matt Rohland
  • 706
  • 10
  • 19