如果 Robot Framework Selenium 中的 id 不唯一,如何单击元素
How to click on an element in case of not unique id in Robot Framework Selenium
示例代码:
<tr class="list-surveyor-assign" data-id="xoghSatJFCJ">
<td style="width: 40%><p style="padding-bottom: 5px;">Miss Anna</p></td>
<button id="btnSelectSurveyor" title="Assign" class="btn btn-sm btn-primary" data-surveyor="xoghSatJFCJ">
<i class="fa fa-user-plus" aria-hidden="true"></i>
</button>
</tr>
<tr class="list-surveyor-assign" data-id="7G8s7AwTzkh">
<td style="width: 40%><p style="padding-bottom: 5px;">Miss Jane</p></td>
<button id="btnSelectSurveyor" title="Assign" class="btn btn-sm btn-primary" data-surveyor="7G8s7AwTzkh">
<i class="fa fa-user-plus" aria-hidden="true"></i>
</button>
如何点击按钮
id="btnSelectSurveyor" with data-surveyor="7G8s7AwTzkh"
您可以使用如下两个单独的属性。
//button[@id='btnSelectSurveryor' and title='Assign']
示例代码:
<tr class="list-surveyor-assign" data-id="xoghSatJFCJ">
<td style="width: 40%><p style="padding-bottom: 5px;">Miss Anna</p></td>
<button id="btnSelectSurveyor" title="Assign" class="btn btn-sm btn-primary" data-surveyor="xoghSatJFCJ">
<i class="fa fa-user-plus" aria-hidden="true"></i>
</button>
</tr>
<tr class="list-surveyor-assign" data-id="7G8s7AwTzkh">
<td style="width: 40%><p style="padding-bottom: 5px;">Miss Jane</p></td>
<button id="btnSelectSurveyor" title="Assign" class="btn btn-sm btn-primary" data-surveyor="7G8s7AwTzkh">
<i class="fa fa-user-plus" aria-hidden="true"></i>
</button>
如何点击按钮 id="btnSelectSurveyor" with data-surveyor="7G8s7AwTzkh"
您可以使用如下两个单独的属性。
//button[@id='btnSelectSurveryor' and title='Assign']