本文介绍了使用正则表达式进行 xpath 查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
很简单,有一个 HTML 文件,还有一个带有变量 id 的 div
id 的整数部分是可变的,所以它可以是 abc_892、abc_553 ...等
获得它的最佳查询是什么?
解决方案
//div[starts-with(@id, "abc_")]
it's very simple there is an HTML file and there is a div with variable id like that
<div id="abc_1"><div>
the integer part of the id is variable so it could be abc_892, abc_553 ...etc
what is the best query to get that ?
解决方案
//div[starts-with(@id, "abc_")]
这篇关于使用正则表达式进行 xpath 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!