【问题标题】:python selenium fill input whit same namespython selenium 用相同的名称填充输入
【发布时间】:2016-03-13 03:50:51
【问题描述】:

我需要在带有硒的表格中填写输入,蝙蝠有小问题,输入具有相同的名称,例如 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/")

【问题讨论】:

    标签: python html selenium


    【解决方案1】:
    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")
    

    【讨论】:

      猜你喜欢
      • 2011-12-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多