Read more

Capybara can match elements outside of <body>

Henning Koch
October 14, 2011Software engineer at makandra GmbH

Capybara will match elements outside of a page's <body> tag.

Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

For example, the step definitions below match <link> nodes in a page's <head>:

Then /^my browser should auto-discover the "([^"]*)" feed$/ do |slug|
  page.should have_css(
    'head link' +
    '[rel="alternate"]' +
    "[href='http://www.example.com/#{slug}/feed.rss']" +
    '[title="RSS feed (all cards)"]' +
    '[type="application/rss+xml"]',
    visible: false
  )
end

Then /^my browser should not auto-discover any RSS feeds$/ do
  page.should_not have_css('head link[rel="alternate"][type="application/rss+xml"]')
end
Posted by Henning Koch to makandra dev (2011-10-14 11:30)