title: xpath search for class and text - combine two xpath selector
body: <p>I know there are tousands of simple question about xpath but i dont get it how to combine two not too simple expressions...</p>
  
  <p>My xml structure:</p>
  
  <pre><code>&lt;div class="some-container"&gt;
      &lt;div class="btn  btn-blue"&gt;
          &lt;div class="btn-text"&gt;&lt;!-- Select by class --&gt;
              &lt;span&gt; &lt;!-- Select by text--&gt;
                  Download
              &lt;/span&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>Select by class</strong></p>
  
  <p>I know achieved to select the div by searching after the class:</p>
  
  <pre><code>//*/div[contains(concat(' ', @class, ' '), ' btn-text')]
  </code></pre>
  
  <hr>
  
  <p><strong>Select by text</strong></p>
  
  <p>To select also the span i know i can simply add <code>/span</code> but then i want to select by text. 
  For that usecase i got the xpath (<a href="https://stackoverflow.com/a/2994336">form here</a>): </p>
  
  <pre><code>//*/text()[normalize-space(.)='Download']/parent::*
  </code></pre>
  
  <hr>
  
  <p>Those selector both are working properly but i want to combine them</p>
  
  <ol>
  <li>Search for class "btn"</li>
  <li>Search for text inside span that exactly matches </li>
  </ol>
  
  <p>I tried to concat like that but that dont work <a href="http://www.xpathtester.com/xpath/48f08aa3038aecfb38e99f2ba5911543" rel="nofollow noreferrer">test-example</a>:</p>
  
  <pre><code>//div[contains(concat(' ', @class, ' '), ' btn-text')]/text()[normalize-space(.)='Download']/parent::*
  </code></pre>
  
  <p>even if it'd work there is no selecting by span tag</p>
  
  <p>Anyone who could help?</p>