How to fill autocomplete one-time-code input by selenium python ?

anhle_ptit

Newbie
Joined
Jun 30, 2020
Messages
21
Reaction score
1
I have trouble in send_keys one input one when fill the OTP code by selenium in python. Somebody can help me ?
html-code
'''
<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>

'''
---------------------------------------------------------------------------------------------------
my solution
'''
while True:
if index > 7:
break
input_cell = WebDriverWait(self.driver, 10).until(lambda driver: self.driver.find_element_by_xpath("//div[@class='UEclfJ _27cR_W']/input[{}]".format(index)))
self.action.move_to_element(input_cell)
print("success cell")
input_cell.send_keys(code[index] - 1)
index+=1
sleep(2)

'''

It not work !
 

Attachments

  • Screenshot (44).png
    Screenshot (44).png
    13.1 KB · Views: 4
Back
Top