Reputation: 27021
<root>
// other nodes
<a href="/PatternFramework/Pages/LogOut.aspx?np=/sites/novatestsite/Home.aspx" slick-uniqueid="92">Sign out</a>
</root>
How to write an xpath which returns the a
tag whose href
contains "logout.aspx"?
For instance something like
//a[@href[contains[., "logout.aspx"]]
Upvotes: 8
Views: 15640
Reputation: 16981
Case-sensitive:
//a[contains(@href,'logout.aspx')]
Case-insensitive for XPath 2.0:
//a[contains(lower-case(@href),'logout.aspx')]
Case-insensitive for XPath 1.0:
//a[contains(translate(@href, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'),'logout.aspx')]
Upvotes: 24