data div id ul li class alfa text li li class alfa text li li class al

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
>>> data = """<div id="1">
<ul>
<li class="alfa">text</li>
<li class="alfa">text</li>
<li class="alfa">text</li>
<li class="alfa beta" style="display:none;">text</li>
<li class="alfa">text</li>
</ul>
</div>"""
>>> e = lxml.etree.fromstring(data)
>>> e.xpath('//div/ul/li[@class="alfa beta"]')
[<Element li at 8beca2c>]