【发布时间】:2019-12-15 01:16:38
【问题描述】:
我有以下 HTML:
<html>
<body>
I do not want this link here <a href="blah">link text</a>
But I want this one here <a href="blah blah">more link text</a>
</body>
</html>
我正在尝试仅获取第二个 <a> 标记,并且正在使用以下内容:
//*[contains(.,"But I want this one here ")]/a
返回
<a href="blah">link text</a>
<a href="blah blah">more link text</a>
我只想
<a href="blah blah">more link text</a>
【问题讨论】:
-
那么您是在寻找文本
I want this one here后面的元素还是只是第二个链接? -
我想要
But I want this one here文本后面的元素