[英]xpath: find a node that has a given attribute whose value contains a string
[英]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>
如何編寫一個返回其href
包含“logout.aspx” a
標簽的xpath?
比如像
//a[@href[contains[., "logout.aspx"]]
區分大小寫:
//a[contains(@href,'logout.aspx')]
對XPath 2.0不區分大小寫:
//a[contains(lower-case(@href),'logout.aspx')]
對XPath 1.0不區分大小寫:
//a[contains(translate(@href, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'),'logout.aspx')]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.