HTML 代码:
<div class='UEclfJ _27cR_W'>
<input type ='tel' autocomplete='one-time-code' maxlength = '6'>
<input class='_1y306T _2ynKud' maxlength = '1'reandonly value>
<input class='_1y306T' maxlength = '1'reandonly value>
<input class='_1y306T' maxlength = '1'reandonly value>
<input class='_1y306T' maxlength = '1'reandonly value>
<input class='_1y306T' maxlength = '1'reandonly value>
<input class='_1y306T' maxlength = '1'reandonly value>
</div>
我尝试在 send_keys 之前删除“readonly”,但它不起作用。我也设置了值,但它无法单击下一步按钮。输入是验证码形式,六个单元格。我看到单击元素时类名是可以更改的。
我的代码:
cell_change = WebDriverWait(self.driver,10).until(lambda driver:self.driver.find_element_by_xpath('//input[contains(@class, "_1y306T") and contains(@class, "_2ynKud")]'))
self.driver.execute_script("arguments[0].removeAttribute('readonly','readonly')", cell_change)
print("remove success")
sleep(3)
cell_change.send_keys("1")
sleep(1)
有人可以帮我解决这个问题或给我一些想法吗?我对此非常感激:(感谢您关心我的问题。
江户川乱折腾
相关分类