xpath中的ends-with无效解决方案

xpath定位遇到如下问题:br/>//*[ends-with(@id,"多测师")]定位不到以"多测师"结尾的元素
原因如下:
ends-with是xpath2.0的语法,可能你的浏览器还只支持1.0的语法

解决如下:
//*[ends-with(@id,"多测师")]

等价于

//input[substring(@id, string-length(@id) - string-length('多测师') +1) = '多测师']

 

原文地址:http://blog.51cto.com/icestick8586/2123176

posted @ 2020-09-28 09:21  粥店接济  阅读(598)  评论(0编辑  收藏  举报