gpt4 book ai didi

xpath - 如何忽略xpath中的第一个元素

转载 作者:行者123 更新时间:2023-12-02 23:54:38 25 4
gpt4 key购买 nike

如何忽略第一个元素并获取其余元素?

<ul>
<li><a href="#">some link</a></li>
<li><a href="#">some link 2</a></li>
<li><a href="#">link i want to find</a></li>
</ul>

谢谢

最佳答案

如果您只想忽略“第一个”元素:

//li[position()>1]
or
(//a)[position()>1]

如果您只想要最后一个(就像您的示例所示):

//li[last()]
or
(//a)[last()]

关于xpath - 如何忽略xpath中的第一个元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2634122/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com