在XPath的帮助下,在以下情况下如何获取href属性的值(仅抓取正确的url)?:
<a href="http://foo.com">a wrong one</a>
<a href="http://example.com">the right one</a>
<a href="http://boo.com">a wrong one</a>
也就是说,如果链接具有特定文本,则获取 href 属性的值。
这将选择属性:
"//a[text()='the right one']/@href"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)