Reputation: 313
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?
Upvotes: 27
Views: 5726
Reputation: 3687
Same issue with the firefox driver here.
Caused by: org.openqa.selenium.WebDriverException: arguments[0] is undefined
Command duration or timeout: 24 milliseconds
Build info: version: '2.44.0', revision: '76d78cf323ce037c5f92db6c1bba601c2ac43ad8', time: '2014-10-23 13:11:40'
System info: host: '', ip: '', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_71'
Session ID: 49a4f55c-33b7-4ab8-aea5-cb3bb98041e1
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=WINDOWS, acceptSslCerts=true, javascriptEnabled=true, cssSelectorsEnabled=true, databaseEnabled=true, browserName=firefox, handlesAlerts=true, nativeEvents=false, webStorageEnabled=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=35.0.1}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:508)
Downgraded firefox to 34.0.5 and the Javascript click:
executeScript("arguments[0].click();", el);
Works again like a charm.
And it is quite important to have a working javascript click, since the native click is just way too unreliable.
Upvotes: 0
Reputation: 2046
As others have said, there is bug in Firefox 35. To avoid that, I found it easiest to config Capybara to run Selenium-tests in Chrome. So if you don't need to run tests particularly in Firefox, you can use chromedriver.
There is a gem for get it easily.
Upvotes: 2
Reputation: 2092
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
Upvotes: 3
Reputation: 4280
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
Upvotes: 16