Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cucumber / Capybara Error: arguments[0] is undefined (Selenium::WebDriver::Error::JavascriptError)

I've been running my tests via the terminal for a while now without any problems.:

cucumber Create\ New\ Game.feature

Which contains the following:

Feature: Create New Game

  Background: 
    Given I am logged in

  Scenario: Cleanup & New Game 01
    Then I Delete all test Games

And the ruby:

Given(/^I am logged in$/) do
  el = first("button[ttag='account_dropdown_btn']", :visible => true)
  if el.nil?
    logMeIn("[email protected]","pa55w0rd")
  end
end

logMeIn defined as:

# Logs the user in with given credentials
def logMeIn(username, password)
  page.driver.browser.manage.window.maximize
  visit ENV['BASE_URL']
  fill_in 'j_username', :with => username
  fill_in 'j_password', :with => password
  click_button 'Login'
end

None of the above has changed from when the tests were working until now. Today, when I start the tests, as soon as Firefox opens, I immediately get:

  Background:            # features/Create New Game.feature:4
    Given I am logged in # features/step_definitions/Generic Steps.rb:1
      arguments[0] is undefined (Selenium::WebDriver::Error::JavascriptError)

As you can see, it's failing on the first line. I don't know why.

I updated all my gems to make sure everything was fresh, but this didn't work. I thought it might have been a browser issue as my system automatically updated to Firefox 35.0 this morning. I uninstalled and tried 34 but it's still the same problem. None of the code has changed.

I don't know what other misconfiguration could've caused this as I haven't changed anything.

Can anyone help further with this error?

like image 297
James Avatar asked Jan 15 '15 09:01

James


2 Answers

Yes, the issue is with Firefox 35. Downgrade to version 34. Perhaps it's the way you went about downgrading. I simply ran the new DMG installer and confirmed overwriting the existing app.

Direct link: https://download-installer.cdn.mozilla.net/pub/firefox/releases/34.0.5/mac/en-US/Firefox%2034.0.5.dmg (link referenced from https://support.mozilla.org/en-US/kb/install-older-version-of-firefox)

More on this issue can be found here: https://code.google.com/p/selenium/issues/detail?id=8387

like image 177
user1322092 Avatar answered Oct 26 '22 01:10

user1322092


As Justin Ko commented, this is a bug with Firefox 35 and Selenium-WebDriver 2.44.0. The Selenium project has an issue ticket for it, and at time of writing, there is a pre-release gem (2.45.0.dev3) that includes the fix.

https://code.google.com/p/selenium/issues/detail?id=8390

like image 43
Marc L Avatar answered Oct 26 '22 00:10

Marc L