title: Using xpath with python lxml to query html
body: <p>I am reading a html page as a string and use <code>tree = html.fromstring(data)</code> </p>
  
  <p>I now want to use lxml xpath to query. Below are an example of the part i am interested in.</p>
  
  <pre><code>&lt;table class="class"&gt;
   &lt;tbody&gt;
    &lt;tr&gt;
     &lt;th class="classTh"&gt;
      Overall
     &lt;/th&gt;
     &lt;td class="classTd"&gt;
      &lt;span class="classSpan"&gt;
       GREEN
      &lt;/span&gt;
     &lt;/td&gt;
    &lt;/tr&gt;
   &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>with the call </p>
  
  <pre><code> xpath = '//table/tbody/tr[th="Overall"]/td/span'
   e = tree.xpath(xpath)
    for i in e:
     print(i.text)
  </code></pre>
  
  <p>I am using xpath to get the data i need. But i cannot get the xpath to work. Using this exact code + xpath in any online tester works for me.</p>
  
  <p>I have tried with xpath:</p>
  
  <pre><code>xpath = '//table/tbody/tr[th]/td/span'
  </code></pre>
  
  <p>which gets me all elements instead of the ones with the correct filter value.</p>
  
  <pre><code> xpath ='//table/tbody/tr[td/span]/th'
  </code></pre>
  
  <p>gets me all the filter values.</p>
  
  <p>So my question. How to i apply the text value filter in my xpath correctly?</p>