【发布时间】:2012-12-10 09:41:45
【问题描述】:
对于下面的代码示例,我需要检查一个带有 type="a" 的 tr 和一个带有文本“3”的 td 是否存在:
<table>
<tr type="a">
<td>1</td>
</tr>
<tr type="b">
<td>1</td>
</tr>
<tr type="a">
<td>3</td>
</tr>
</table>
试过这个:
b.tr( :xpath =>"//tr[@type='a']").td( :text =>'3').exists?
但它不起作用(xpath 表达式仅返回 2 个现有的第一个 tr)。
有什么想法吗?
如果我需要的 tr 存在,是否有一个 xpath 表达式将返回 true ?
【问题讨论】:
标签: xpath watir-webdriver