Working in lxml, I want to get the href
attribute of all links with an img
child that has title="Go to next page"
.
So in the following snippet:
<a class="noborder" href="StdResults.aspx">
<img src="arrowr.gif" title="Go to next page"></img>
</a>
I'd like to get StdResults.aspx
back.
I've got this far:
next_link = doc.xpath("//a/img[@title='Go to next page']")
print next_link[0].attrib['href']
But next_link
is the img
, not the a
tag - how can I get the a
tag?
Thanks.