Capybara-Webkit:page.should has_content()没有实现?

时间:2022-08-23 12:37:30

I have recently attempted to use:

我最近试图使用:

Then(/^I should see "(.*?)"$/) do |arg1|
  page.should have_content(arg1)
end

To query the page and see if a text exists on the page.

查询页面并查看页面上是否存在文本。

This worked fine with the default Capybara driver, but after setting the javascript driver to capybara-webkit and running the tests again I get:

这与默认的Capybara驱动程序一起工作正常,但在将javascript驱动程序设置为capybara-webkit并再次运行测试后,我得到:

  undefined method `find_xpath' for #<Capybara::Webkit::Driver:0x007fa3f00152e8> (NoMethodError)
  ./features/step_definitions/customer_steps.rb:12:in `/^I should see "(.*?)"$/'
  features/manage_customers.feature:10:in `Then I should see "ABC XYZ"'

I am using the javascript driver since I am also using AngularJS to populate my data.

我正在使用javascript驱动程序,因为我也使用AngularJS来填充我的数据。

My questions:

  1. Are have_content() and page.has_content?() not implemented in capybara-webkit?
  2. 是不是在capybara-webkit中实现了have_content()和page.has_content?()?

  3. What could be the source of the problem?
  4. 可能是问题的根源是什么?

1 个解决方案

#1


3  

Looks like there may be an issue with capybara-webkit: https://github.com/thoughtbot/capybara-webkit/issues/499

看起来capybara-webkit可能存在问题:https://github.com/thoughtbot/capybara-webkit/issues/499

I added gem 'capybara', '2.0.3' to my gemfile for now and that seems to fix the issue.

我现在为我的gemfile添加了gem'capybara','2.0.3',这似乎解决了这个问题。

#1


3  

Looks like there may be an issue with capybara-webkit: https://github.com/thoughtbot/capybara-webkit/issues/499

看起来capybara-webkit可能存在问题:https://github.com/thoughtbot/capybara-webkit/issues/499

I added gem 'capybara', '2.0.3' to my gemfile for now and that seems to fix the issue.

我现在为我的gemfile添加了gem'capybara','2.0.3',这似乎解决了这个问题。