xpath选择兄弟节点、返回上一级和选择多个属性



本文链接:https://blog.csdn.net/ZincZhang/article/details/80248297
选择兄弟节点
选择前N位的div标签
preceding-sibling::div[N]
选择后N位的div标签
following-sibling::div[N]
选择上一级
../
结合使用
//td[text()='xxx']/../followingsibling::tr//tbody//td[contains(@class, p15)]/table/tbody

排除一个属性的节点
//tbody/tr[not(@class)]
//tbody/tr[not(@class or @id)]

选择一个有某个属性的元素
//div[@name]


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM