XPATH for checkbox其中id,type和name在Selenium中相同

时间:2017-10-30 06:30:33

标签: selenium xpath checkbox

请查看以下代码:

id= idConfirmedCheckbox的XPath是什么?

<td class="tdCenter">
<input id="idConfirmedCheckbox" type="checkbox" onclick="return idConfirmedClicked(this);" name="idConfirmedCheckbox"/>
<input id="Customer_Person_Identifications_Identification_0_Confirmed" type="hidden" value="N" name="Customer_Person_Identifications_Identification_0_Confirmed"/>
<input id="Customer_Person_Identifications_Identification_0_NotConfirmedDisabled" type="hidden" value="" name="Customer_Person_Identifications_Identification_0_NotConfirmedDisabled"/>
</td>
<td class="tdCenter">
<input id="idConfirmedCheckbox" type="checkbox" onclick="return idConfirmedClicked(this);" name="idConfirmedCheckbox"/>
<input id="Customer_Person_Identifications_Identification_1_Confirmed" type="hidden" value="N" name="Customer_Person_Identifications_Identification_1_Confirmed"/>
<input id="Customer_Person_Identifications_Identification_1_NotConfirmedDisabled" type="hidden" value="" name="Customer_Person_Identifications_Identification_1_NotConfirmedDisabled"/>
</td>

1 个答案:

答案 0 :(得分:0)

尝试以下Xpath:

//input[@id='idConfirmedCheckbox']

OR

//input[@id='idConfirmedCheckbox' and @type='checkbox']

OR

(//input[@id='idConfirmedCheckbox' and @type='checkbox'])[1]

根据需要将数组更改为1到2或3