【发布时间】:2016-12-14 10:57:42
【问题描述】:
考虑下表结构包含许多行和多个列值。我需要识别特定行的父行,必须使用单元格来识别。
<table class = 'grid'>
<thead id = 'header'>
</thead>
<tbody>
<tr>
<td>
<span class="group">
<span class="group__link"><a class="disabledlink"">copy</a>
</span>
</span>
</td>
<td class="COLUMNNAME">ACE</td>
<td class="COLUMNLONGNAME">Adverse Childhood Experiences</td>
<li>Family Medicine</li>
<li>General Practice</li>
</td>
<td class="COLUMNSEXFILTER">Both</td>
<td class="COLUMNAGEFILTERMIN">Any</td>
<td class="COLUMNTYPE">Score Only</td>
</tr>
<tr>
<td class="nowrap" showactionitem="2">
<span class="group">
<span class="group__link"><a onclick="Check()" href="#">copy</a>
</span>
</span>
</td>
<td class="COLUMNNAME">AM-PAC</td>
<td class="COLUMNLONGNAME">AM-PAC Generic Outpatient Basic Mobility Short Form</td>
<td class="COLUMNNOTE"></td>
<td class="COLUMNRESTRICTEDYN">No</td>
<td class="COLUMNSPECIALTYID"></td>
<td class="COLUMNSEXFILTER">Both</td>
<td class="COLUMNAGEFILTERMIN">Any</td>
<td class="COLUMNTYPE">Score Only</td>
</tr>
<tr></tr>
<tr></tr>
</tbody></thead>
</table>
同样,此表包含大约 100 行。我使用迭代做了同样的事情,它工作正常。 是否可以在不迭代的情况下找到特定行的父级?
【问题讨论】:
-
您想使用单元格来定位行吗?
-
你能把你的编码也加进去以供参考吗?
-
当您说“特定行的父级”时,您是要获取包含该单元格的
tr元素还是包含该单元格的tr的父级?措辞暗示后者,但我认为您想要前者?
标签: ruby automation watir watir-webdriver