Cucumber/Capybara错误:arguments [0]未定义(Selenium :: WebDriver :: Error :: JavascriptError)

Jam*_*mes 28 ruby selenium cucumber capybara capybara-webkit

我一直在终端上运行测试一段时间没有任何问题:

黄瓜创造\新\ Game.feature

其中包含以下内容:

Feature: Create New Game

  Background: 
    Given I am logged in

  Scenario: Cleanup & New Game 01
    Then I Delete all test Games
Run Code Online (Sandbox Code Playgroud)

而红宝石:

Given(/^I am logged in$/) do
  el = first("button[ttag='account_dropdown_btn']", :visible => true)
  if el.nil?
    logMeIn("user@user1.com","pa55w0rd")
  end
end
Run Code Online (Sandbox Code Playgroud)

logMeIn定义为:

# 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
Run Code Online (Sandbox Code Playgroud)

从测试工作到现在,上述情况都没有改变.今天,当我开始测试时,一旦Firefox打开,我立即得到:

  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)
Run Code Online (Sandbox Code Playgroud)

正如你所看到的,它在第一行失败了.我不知道为什么.

我更新了所有的宝石,以确保一切都很新鲜,但这不起作用.我认为这可能是一个浏览器问题,因为我的系统今天早上自动更新到Firefox 35.0.我卸载并尝试了34但它仍然是同样的问题.这些代码都没有改变.

我不知道其他什么错误配置可能导致这一点,因为我没有改变任何东西.

谁能帮助进一步解决这个错误?

use*_*092 17

是的,问题在于Firefox 35.降级到版本34.也许这就是你降级的方式.我只是运行新的DMG安装程序并确认覆盖现有的应用程序.

直接链接:https://download-installer.cdn.mozilla.net/pub/firefox/releases/34.0.5/mac/en-US/Firefox%2034.0.5.dmg(链接参考https:// support. mozilla.org/en-US/kb/install-older-version-of-firefox)

有关此问题的更多信息,请访问:https://code.google.com/p/selenium/issues/detail?id = 8387

  • 我把Firefox 34放在一个单独的目录中,如果ENV ['firefox_path']`然后设置那个env变量,让我的capybara使用`Selenium :: WebDriver :: Firefox :: Binary.path = ENV ['firefox_path']跑黄瓜. (2认同)