英文:
How to get perfect match text using XPath selector?
问题
所以,仅匹配完全匹配文本的XPath是什么?
XPath for the only perfect matched text is:
仅匹配完全匹配文本的XPath是:
//select[@id="dropdownid"]/option[text()="udhav"]
英文:
For example:
XML file:
<root>
<dropdwon>
<option>
<udhav sarvaiya>
<udhav sarvaiya v>
<udhav>
</option>
</dropdown>
</root>
I just want to get this string/text in my dropdown: udhav
so, I have used this XPath:
//select[@id="dropdownid"]/option[contains(text(), "udhav")]
but It's giving me 3 outputs:
udhav sarvaiya
udhav sarvaiya v
udhav
I only need output udhav
So, what is XPath for the only perfect matched text?
答案1
得分: 1
尝试使用以下XPath:
//select[@id="dropdownid"]/option[text()="udhav"]
英文:
Try with the below Xpath:
//select[@id="dropdownid"]/option[text()="udhav"]
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论