【问题标题】:cucumber watir firefox not shutting down after test测试后黄瓜水火狐没有关闭
【发布时间】:2012-10-22 21:48:25
【问题描述】:

我刚刚开始使用 cucumber 和 watir 进行一些站点测试,一切正常,但测试后 firefox 并没有关闭。我收到此错误:

!!! error running onStopped callback: TypeError: callback is not a function
*** LOG addons.xpi: shutdown
!!! error running onStopped callback: TypeError: callback is not a function
*** LOG addons.xpi: shutdown
!!! error running onStopped callback: TypeError: callback is not a function
*** LOG addons.xpi: shutdown

有什么想法吗?

抱歉 - 忘记了示例代码!

require 'watir-webdriver'

Before do
  $browser = Watir::Browser.new
end

After do
  $browser.close
end

Given ... (etc. - all the step defs here)

【问题讨论】:

  • 请分享导致错误的代码。
  • 糟糕 - 抱歉,小学生错误 :-)

标签: firefox cucumber bdd watir


【解决方案1】:

为什么在BeforeAfter 块中使用全局变量$browser?尝试改用实例变量@browser。 (确保将所有出现的$browser 更改为@browser。)

【讨论】:

    猜你喜欢
    • 2012-01-18
    • 2017-10-13
    • 2012-07-06
    • 2020-12-19
    • 1970-01-01
    • 2010-11-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多