51
votes

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/[email protected]/components/driver_component.js:8360:in `r'
 # [remote server] file:///tmp/webdriver-profile20130807-3105-fpynb7/extensions/[email protected]/components/driver_component.js:392:in `fxdriver.Timer.prototype.runWhenTrue/g'
 # [remote server] file:///tmp/webdriver-profile20130807-3105-fpynb7/extensions/[email protected]/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.

4

4 Answers

85
votes

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.

4
votes

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.

1
votes

I ran the below and it worked :

 gem install selenium-webdriver -v "2.35.0"
0
votes

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: