gpt4 book ai didi

xpath - 具有排除功能的复杂 xpath

转载 作者:行者123 更新时间:2023-12-03 17:25:38 27 4
gpt4 key购买 nike

我正在尝试提取带有排除项的 xpath,但无法执行此操作。

 (//div[@class='row site country-names']/following-sibling::div)[1]/div

上面的 xpath 提取了所有三个 div,但是我需要排除具有点分隔符的 div。
enter image description here

我尝试了异常(exception),但它不起作用。
 (//div[@class='row site country-names']/following-sibling::div)[1]/div and not [@class='dot-seperator']

最佳答案

您需要使用 not排除任何属性,例如类:

//div[@class='row site country-names']/following-sibling::div[not(@class)]

将 @ 与属性名称一起使用:
[not(@attribute_name)]

关于xpath - 具有排除功能的复杂 xpath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45035681/

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