I've got this xpath query:
/html/body//tbody/tr[*]/td[*]/a[@title]/@href
It extracts all the links with the title attribute - and gives the href in FireFox's Xpath checker add-on.
However, I cannot seem to use it with lxml.
from lxml import etree
parsedPage = etree.HTML(page) # Create parse tree from valid page.
hyperlinks = parsedPage.xpath("/html/body//tbody/tr[*]/td[*]/a[@title]/@href") # Xpath query
for x in hyperlinks:
print x # Print links in <a> tags, containing the title attribute
This produces no result from lxml (empty list).
How would one grab the href text (link) of a hyperlink containing the attribute title with lxml under python?