I am using XPath to pull data off of a web page.
I have a link that I want to get the href value of. I can reference it through its unique id: id('unique-id'), but that gives me the string between the <a> tags.
How do I get the value of the href attribute?
Try this XPath: //a[@id = 'unique-id']/@href. This XPath will select href attribute of a element with attribute id = unique-id
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With