There are many methods we could use in Xpath locator which makes the locator type more relaint. contains(), text(), starts-with(), ends-with().
G(l
ends-with normally belongs Xpath2.0. Browsers normally take Xpath1.0.
So alternate for ends-with, we can use substring method with little logic.
Look at the below example.
Syntax,
//input[substring(@attributename, string-length(@id) -
string-length('sample') +1) = 'sample']
Example,
//input[substring(@id, string-length(@id) -
string-length('_PHONE$1') +1) = '_PHONE$1']
No comments:
Post a Comment