简体   繁体   中英

xPath - Extracting a contents of a href from an anchor link

I am having difficulty extracting the contents of a href from an anchor tag with xPaths. I want to extract the contents of the href only, not the text contained within the anchor elements.

This is what I've come up with so far but it doesn't seem to be working.

//a/@href[contains("@", 'mailto')]/text()

I also tried:

//a/href[contains("@", 'mailto')]/text()

Anyone have any suggestions, greatly appreciated!

请求@href而不是text()并检查@href属性是否包含mailto

//a[contains(@href, 'mailto')]/@href

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM