title: Finding html element with class using lxml
body: <p>I've searched everywhere and what I most found was doc.xpath('//element[@class="classname"]'), but this does not work no matter what I try.</p>
  
  <p>code I'm using</p>
  
  <pre><code>import lxml.html
  
  def check():
      data = urlopen('url').read();
      return str(data);
  
  doc = lxml.html.document_fromstring(check())
  el = doc.xpath("//div[@class='test']")
  print(el)
  </code></pre>
  
  <p>It simply prints an empty list.</p>
  
  <p>Edit:
  How odd. I used google as a test page and it works fine there, but it doesn't work on the page I was using (youtube)</p>
  
  <p>Here's the exact code I'm using.</p>
  
  <pre><code>import lxml.html
  from urllib.request import urlopen
  import sys
  
  def check():
      data = urlopen('http://www.youtube.com/user/TopGear').read(); #TopGear as a test
      return data.decode('utf-8', 'ignore');
  
  
  doc = lxml.html.document_fromstring(check())
  el = doc.xpath("//div[@class='channel']")
  print(el)
  </code></pre>