title: Find elements by data attributes
body: <p>I'm improving my tests with <code>RSpec</code> and <code>capybara-webkit</code>, trying to delete all the <code>css</code> and <code>xpath</code> selectors like</p>
  
  <pre><code>find('#edit_user &gt; div:nth-child(7) &gt; div &gt; div &gt; button').click
  </code></pre>
  
  <p>and I'm looking for the best option to replace them.<br><br>
  I was going to use the <code>css class</code> of the elements but some "pro" capybara tester said this is not the best option.<br></p>
  
  <p>So my question is: can I use the <code>data</code>attributes in my tests?<br>If I have an element</p>
  
  <pre><code>&lt;button name="button" type="submit" class="button last" data-test="edit.update"&gt;Update/button&gt;
  </code></pre>
  
  <p>will I be able to do</p>
  
  <pre><code>find('edit.update').click
  </code></pre>
  
  <p>?</p>
  
  <p>And do you think it is a good idea? If you have more ideas/infos about this topic, feel free to comment!</p>