title: XPath Select by text within link, link also contains i
body: <p>I am trying to use XPath to find a link in a list of links (tabs) based on the text of the link. The problem is that they also have icons (which are at the moment hidden) so simply using text() isn't matching them.</p>
  
  <p>I tried: </p>
  
  <ul>
  <li><code>//ul[contains(@class, 'nav-tabs')]/li/a[text()='Details']</code> </li>
  <li><code>//ul[contains(@class, 'nav-tabs')]/li/a[normalize-space(text())='Details']</code> </li>
  </ul>
  
  <p>but neither finds the Details tab. Simply doing <code>//ul[contains(@class, 'nav-tabs')]/li/a</code> does get me all the links and I can see the <code>&lt;i&gt;</code> and <code>Details</code> text within them then, but I can't get just the "Details" link. </p>
  
  <p>I wanted to avoid using contains() because I am concerned that we will have two tabs that could be matched that way if one word is within a larger word, so I wanted to match it exactly.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;ul class="nav nav-tabs"&gt;
      &lt;li class="active"&gt;
          &lt;a href="#s52ae1defa2b1e_1" data-toggle="tab"&gt;
              &lt;i class="icon-exclamation-sign has-errors hide"&gt;&lt;/i&gt;
              Details
          &lt;/a&gt;
      &lt;/li&gt;
      &lt;li class=""&gt;
          &lt;a href="#s52ae1defa2b1e_2" data-toggle="tab"&gt;
              &lt;i class="icon-exclamation-sign has-errors hide"&gt;&lt;/i&gt;
              Description
          &lt;/a&gt;
      &lt;/li&gt;
      &lt;li class=""&gt;
          &lt;a href="#s52ae1defa2b1e_3" data-toggle="tab"&gt;
              &lt;i class="icon-exclamation-sign has-errors hide"&gt;&lt;/i&gt;
              SEO
          &lt;/a&gt;
      &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>