我正在使用Selenium实现web自动化,但无法选择具有onClick属性且没有href和类名的锚标记。下面是表单的源代码,我想在其中单击第一个和第三个锚定标记
<td colspan="4" class="leftTopFormLabel">
12. Details of Nominee :<span class="mandatoryField">*</span>
</td>
<td colspan="2" class="lastFormValue">
<a onclick="openWin('NomineeDetails.aspx','','dialogWidth:1000px; dialogHeight:800px; center:yes')"
style="text-decoration: Dynamic; color: Blue; cursor: pointer">Enter Details Here</a>
</td>
</tr>
<tr class="lastData_Section" id="Tr12">
<td colspan="4" class="leftTopFormLabel">
13. Family Particulars of Insured Person:
</td>
<td colspan="2" class="lastFormValue">
<a onclick="openWin('FamilyDetails_New.aspx','','dialogWidth:1000px; dialogHeight:800px; center:yes');"
target="_blank" style="text-decoration: Dynamic; color: Blue; cursor: pointer">Enter
Details Here</a>
</td>
</tr>
<tr class="lastData_Section" id="Tr18">
<td colspan="4" class="leftTopFormLabel">
14. Details of Bank Accounts of Insured Person:<span class="mandatoryField">*</span>
</td>
<td colspan="2" class="lastFormValue">
<a onclick="openWin('EmployeeBankDetails.aspx','','dialogWidth:1000px; dialogHeight:800px; center:yes');"
style="text-decoration: Dynamic; color: Blue; cursor: pointer">Enter Details Here</a>
</td>
</tr>
有人能推荐我吗
这应该行得通。使用contains方法分析onclick属性:
没有任何
<a>...</a>
元素具有href
属性。它们都没有class
属性这里有一种方法可以选择那些具有
onclick
属性但没有target
属性的对象相关问题 更多 >
编程相关推荐