在Xpath定位中如果希望使用ends-with会发现不支持的问题,答案如下:
The ends-with
function is part of xpath 2.0 but browsers (you indicate you’re testing with chrome) generally only support 1.0. So you’ll have to implement it yourself with a combination of string-length
, substring
and equals
substring(@id, string-length(@id) - string-length('register') +1) = 'register'
https://stackoverflow.com/questions/22436789/xpath-ends-with-does-not-work