xpathcontains

Posted currynashinians000

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xpathcontains相关的知识,希望对你有一定的参考价值。

starts-with 顾名思义,匹配一个属性开始位置的关键字

contains 匹配一个属性值中包含的字符串

text() 匹配的是显示文本信息,此处也可以用来做定位用

eg

//input[starts-with(@name,‘name1‘)]     查找name属性中开始位置包含‘name1‘关键字的页面元素

//input[contains(@name,‘na‘)]         查找name属性中包含na关键字的页面元素

<a href="http://www.baidu.com">百度搜索</a>

xpath写法为 //a[text()=‘百度搜索‘] 

或者 //a[contains(text(),"百度搜索")]

以上是关于xpathcontains的主要内容,如果未能解决你的问题,请参考以下文章