xml - XPath to find an element whose attribute contains a text, case-insensitively? -
<root> // other nodes <a href="/patternframework/pages/logout.aspx?np=/sites/novatestsite/home.aspx" slick-uniqueid="92">sign out</a> </root>
how write xpath returns a
tag href
contains "logout.aspx"?
for instance
//a[@href[contains[., "logout.aspx"]]
case-sensitive:
//a[contains(@href,'logout.aspx')]
case-insensitive xpath 2.0:
//a[contains(lower-case(@href),'logout.aspx')]
case-insensitive xpath 1.0:
//a[contains(translate(@href, 'abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxyz'),'logout.aspx')]
Comments
Post a Comment