Question

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:

  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.

My questions:

  1. Are have_content() and page.has_content?() not implemented in capybara-webkit?
  2. What could be the source of the problem?
Was it helpful?

Solution

Looks like there may be an issue with 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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top