xpath搜索div,其中id包含特定文本 [英] xpath search for divs where the id contains specific text
本文介绍了xpath搜索div,其中id包含特定文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的HTML页面上,我有40个div,但我只想要一个div
On my HTML page I have forty divs but I only want one div
使用敏捷包搜索并使用我使用的ID获取所有div
Using agility pack to search and get all the divs with Ids I use this
"//div[@id]"
但是如何在ID包含文本"test"的ID中搜索divs
BUT how do I search for divs with Ids where the id contains the text "test"
<div id="outerdivtest1></div>"
谢谢
推荐答案
使用contains
函数:
//div[contains(@id,'test')]
这篇关于xpath搜索div,其中id包含特定文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文