XPath定位

id

name

linktext   匹配链接文本属性   a标签

tag_name  匹配标签名字

class_name  匹配class属性

xpath模糊定位

//a[contains(@href,logout)]

@后面跟属性,“,”后面的是属性包含值

//a[starts-with(@rel,'info')]

以rel属性info开头的标签

//a[contains(text(),'退出')]

匹配文本中包含“退出两个文字的标签”

更多的信息  endswith等

原文地址:https://www.cnblogs.com/python-robot/p/XPath.html