xpath - 使用 Xpath 在 Automation Anywhere 中的特定行之后获取表的所有行
问题描述
我正在尝试使用 xpath 获取特定行之后的所有行的值(可以使用 id 标识此特定行)。请注意,我在自动化任何地方的对象克隆命令中使用它来定位和获取详细信息。假设这是表格:
<table class="actiontable" >
<tbody>
<tr></tr>
<tr></tr>
<tr id="h32423">
<td class="claim"><span id="claimants">Claimants</span></td>
</tr>
<tr id="a23">
<td id="g543"><a href="some site">Edward Hunter</a> </td>
</tr>
<tr>
<td id="g544"><a href="some site">Jane Doe</a> </td>
</tr>
<tr></tr>
</tbody>
</table>
在上表中,我需要获取 Claimants 行之后的所有名称。有什么建议么?
解决方案
I'm not sure whether it's too late to answer or not. I think the following XPath match your condition.
//tr[td[span[@id='claimants']]]/following-sibling::tr/td/a
*You can change /tr/td/a
to /tr
or /tr/td
according to which element you want to access
I try this XPath in XPath Search console on Google Chrome and it navigate to all a
tags after the row which has ID = claimants.
As I'm quite new to AA, I don't know how to loop through those a tags getting from the XPath. But I hope this help you solve the problem. :)
[Update] I found the solution
1. Using //tr[td[span[@id='claimants']]]
with Object Cloning to get the index of the specific row. Let's say the index value is stored in variable $vIndex$
2. Loop through all td
in the table
3. If the $Counter$
> $vIndex$
THEN that is the row under the specific row.
推荐阅读
- python - 错误=surrogateescape vs 错误=替换
- python - 数据中 LSTM 的输入形状是什么?
- c# - 是否可以在单个 azure 函数中订阅多个容器的更改提要
- reactjs - 无法将反应代码链接到 html 成功
- javascript - 在 JSON 中搜索部分值匹配并应用属性的方法
- python - 如何在具有巨大数组的python多处理中跟踪pool.close和pool.join操作
- python - 将权重应用于 Pandas 数据框以识别重复项
- laravel - 在 Passport Laravel 上进行测试的步骤
- tableau-api - 如何在 Tableau 中使用参数作为过滤器?
- python-3.x - 使用 try-except 语句打印错误结果的错误处理