title: Capybara selector for a span within a
body: <p>Hello I've been struggling with a should be simple select with capybara. This is what I'm after on my page :</p>
  
  <pre><code>&lt;a title="Activity" class="" href="/changes"&gt;Activity &lt;span class="badge"&gt;1&lt;/span&gt;&lt;/a&gt;
  </code></pre>
  
  <p>I need to assert that there is a <code>span.badge</code> with value <code>1</code> inside activity <code>a</code> tag.</p>
  
  <p>Before I posted this, printed the page contents and did a <code>save_and_open_page</code> and this content is there.</p>
  
  <p>This is what I tried (which seemed most promising cant even find a tag) :</p>
  
  <pre><code>find(:xpath, "//a[contains(.,'Activity')]")
  find(:xpath, "//a[contains(@title, \"Activity\")]")
  find(:xpath, "//a[@title='Activity']")
  find(:xpath, "//a", :text =&gt; /reActivity /i)
  </code></pre>
  
  <p>And so many other things not worth mentioning, how would you do this? </p>
  
  <p><strong>Question update:</strong></p>
  
  <p>I forgot to mention that this html is actually hidden initially on the page as it is part of a sub menu. So adding <code>Capybara.ignore_hidden_elements = false</code> works but it kind of sux to add this global config to your test, any other ideas?</p>