我需要在表格中填充输入白硒,蝙蝠有小问题,输入有相同名称,例如html:
<table class="box active" id="datiReceiverBox">
<tbody><tr>
<td><label>Nome*</label><input class="chars24 gray_bg" disabled="" type="text"></td><td style="width:54%" colspan="2" class="btnSelReceiver"><a href="javascript:void(0)" class="btn chars14 show_msg_assenza_contratto"><span>SELEZIONA BENEFICIARIO</span></a><a href="javascript:void(0)" class="btn chars14 show_msg_assenza_contratto"><span>SALVA BENEFICIARIO</span></a></td>
</tr>
<tr>
<td><label>Cognome*</label><input class="chars24 gray_bg" disabled="" type="text"></td>
</tr>
</tbody></table>
需要填写标签Nome和cognome,我该怎么做? 我的代码是:
driver = self.driver
driver.get("https://localhost:8443/member/")
答案 0 :(得分:0)
driver.find_element_by_xpath('//label[contains(text(),"Nome"]/input').send_keys("text here")
driver.find_element_by_xpath('//label[contains(text(),"Cognome"]/input').send_keys("and here")