Rails 3中的Cucumber,Webrat和Selenium NoMethodError

Mag*_*nus 5 selenium ruby-on-rails webrat cucumber

我在使用硒时遇到了问题.当我有一个使用"我应该在条形图中看到foo"网页步骤的场景时,我会收到以下错误:

NoMethodError: undefined method `within' for #<Webrat::SeleniumSession:0x000000057ea608>
Run Code Online (Sandbox Code Playgroud)

它只使用黄瓜和没有硒的webrat工作正常.

这是我的env.rb中的webrat配置块:

Webrat.configure do |config|
  config.mode = :selenium
  config.application_framework = :rack
  config.open_error_files = false # Set to true if you want error pages to pop up in the browser
end
Run Code Online (Sandbox Code Playgroud)

以下是导致问题的步骤(它的实现在web_steps.rb中)

Then I should not see "2" within "#node"
Run Code Online (Sandbox Code Playgroud)

Ali*_*irH -1

可以贴一下你的步骤吗?其定义位于 web_steps.rb 中

您确定您的步骤与此文件中的正则表达式匹配吗?据我所知,“foo”和“bar”周围应该有双引号