有了这样一棵dom树:
<tr></tr>
<tr style=""></tr>
<tr width=""></tr>
如何使用xpath获取attr样式的标签tr?
我尝试过 //tr[@style]
的 xpath表达式,但它返回 0 trs。
如果我使用 //tr[@*]
它会返回 2 个 tr。
怎么了?
最佳答案
尝试 //tr[@style='']
,@style 选择属性的值,由于它为空,因此被视为 false。
关于java - 如何使用 xpathexpression 获取 <tr style ="">,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8586574/