//
所有子子孙孙
1 | //div |
1 | //div//span |
/
所有的直接第一级子元素
1 | //div/span |
[]
选某个元素的属性
1 | //div[@class="f6 text-gray mt-2"] |
*
任意单个元素
1 | //div/a/* |
text()
文本元素
1 | //div/p[text()="pio"] |
1 | //div[@class='f6 text-gray mt-2']//span[text()="TypeScript"] |
contains(属性,”值”)
1 | //div//p[contains(text(),"忘记密码")] |
startwith(属性,”属性开头值”)
1 | //div[starts-with(text(),'忘记密码')] |
1 | //div[@class="f6 text-gray mt-2"]//a[starts-with(@class,"d-inline-block")] |
/@href
选取href属性
1 | /a/@href |
and
属性多选
1 | //div[starts-with(@class,"WB_text") and @nick-name='xxx微博' ]/a[@action-type="feed_list_url" and starts-with(@suda-uatrack,"key=tblog_card")]/@href |
节点关系
1 |
|
##谓语
1 | 放在[]中的几种查找方式写法如下: |