I get an html tag with xpath, with conditions, and now i get the value with text(). Is there any way to get attributes from this value? (text())
Value from text()
document.write("<a href="http://www...">hello</a>");
Now i'll get the whole line (thats ok so far). And now i want so get the /@href from that value.
Here my code:
code = "...<script>document.write("<a href="http://www...">hello</a>"); </script>..."
doc = lxml.html.fromstring(code)
value = doc.xpath( "//script[contains(text(), 'document.write') and (contains(text(),'href'))]//text()" )
I can try it with regex, but maybe there is another good way to fix my problem with xpath.
Thanks