I\'m working with Ruby on Rails 3, Cucumber, and Capybara
I\'ve been searching for quite some time, and I can\'t figure out how to find a specific page element within a
Capybara's within matcher only matches the first result, so if you have multiple h2 tags, it'll only look in the first one.
within
h2
Instead, try have_css with the :text option.
have_css
:text
page.should have_css("#table", :text => "[Name]") page.should have_css('h2', :text => 'stuff')