#python #selenium
#python #селен
Вопрос:
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>
мое решение:
for i in range(6):
cell = WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable((By.XPATH, "(//input[@class='_1y306T'])[{}]".format(i 1))))
sleep(2)
cell.click()
print("click successful")
cell_change = WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.XPATH, "(//input[@class='_1y306T _2ynKud'])")))
print("cell exist")
sleep(2)
cell_change.send_keys("1")
Не удается отправить ключ один ввод один. Может ли кто-нибудь помочь мне заполнить этот ввод с помощью selenium в python.Большое вам спасибо
Комментарии:
1. Может быть, вы можете попробовать использовать input_cell.click() перед send_keys(), и вам не нужно move_to_element() .
2. да, я пробовал, он по-прежнему терпит неудачу, у ввода есть атрибут «значение только для чтения», поэтому я думаю, что проблема здесь