title: Capybara, finding within a css element
body: <p>I'm working with Ruby on Rails 3, Cucumber, and Capybara</p>
  
  <p>I've been searching for quite some time, and I can't figure out how to find a specific page element within a css tag. In my case, I need to make sure that a name is found inside of a table, and not in the "Welcome [Name]".</p>
  
  <p>I tried something like:</p>
  
  <pre><code>within('table') do
    page.body.index("[Name]")
  end
  </code></pre>
  
  <p>And I have a table with <code>id='table'</code>.</p>
  
  <p>But I'd like to know how to do this for any css element, such as:</p>
  
  <pre><code>within('h2') do
    page.body.should have_content ('stuff')
  end
  </code></pre>
  
  <p>I think my problem has to do with page.body, but I'm not sure how to contain it to a particular css tag.</p>
  
  <p>Thanks in advance!</p>