【笔记整理】xpath复习

又是xpath.... 10年前学java就学过了...哈哈哈

要就看w3cschool的教程就行了,

函数部分会用得到:

https://www.w3school.com.cn/xpath/xpath_functions.asp

举个例子:

element.xpath("//div[contains(@class, 'title')]")
//*[contains(@class,'filter') and contains(@class,'clearfix')]/a/text() 获取 class属性值包含 filte并且包含 clearfix的任意元素下的 a 子节点中的文本
//a[not(contains(@href,'detail'))] 选取任何a标签中href属性不包含detail的a标签
//a[text()=‘baidu’] 选取a标签的text等于baidu的a标签
//a[starts-with(@href,'//detail.tmall.com')] a标签属性href开头等于//detai.tmall.com
posted @   运维爱背锅  阅读(9)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
💬
评论
📌
收藏
💗
关注
👍
推荐
🚀
回顶
收起
  1. 1 404 not found REOL
404 not found - REOL
00:00 / 00:00
An audio error has occurred.