title: Finding a specific row in a table using capybara
body: <p>I have a users table that list out the users' ID, name, email and username. What I am attempting to do is verify that a specific entry is in that table. </p>
  
  <p>So essentially what I would like to do is find the row that has ID = 22, then verify that <code>name = John Smith</code>, <code>email = john@smith.com</code> and <code>username = jsmith</code>. The able is setup as show below. What I don't understand is a couple of things...</p>
  
  <ol>
  <li>How do I get a row with specific text, I.E. that as user.id = 22. </li>
  <li>Once I have that row, how do I use it get each of the elements. </li>
  </ol>
  
  <p>I thought I could do a sort of for loop but can't figure out how to set the <code>has_selector?</code> condition. (below is pseudocode)</p>
  
  <pre><code>page.all('tr').each do |tr|
    next unless tr.has_selector?('td.id = 22') #psuedocode
  
    expect(tr.get('td.name').to eq("John Smith")
    #other expects here...
  end 
  </code></pre>
  
  <p><strong>Table code</strong> </p>
  
  <pre><code>&lt;table class="table table-striped table-condensed"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;ID&lt;/th&gt;
        &lt;th&gt;Name&lt;/th&gt;
        &lt;th&gt;Email&lt;/th&gt;
        &lt;th&gt;Username&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
      &lt;% @users.each do |user| %&gt;
        &lt;tr&gt;
          &lt;td class="id"&gt;&lt;%= user.id %&gt;&lt;/td&gt;
          &lt;td class="name"&gt;&lt;%= link_to user.name, user %&gt;&lt;/td&gt;
          &lt;td class="email"&gt;&lt;%= user.base_name %&gt;&lt;/td&gt;
          &lt;td class="username"&gt;&lt;%= user.username %&gt;&lt;/td&gt;
        &lt;/tr&gt;
      &lt;% end %&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>