anhle_ptit
Newbie
- Jun 30, 2020
- 21
- 1
I have trouble in send_keys() function T.T. It finded element , clicked but can not send keys
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 code:
'''
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()
# cell_change = WebDriverWait(self.driver,20).until(EC.presence_of_element_located((By.CLASS_NAMES,"_1y306T _2ynKud")))
cell_change = WebDriverWait(self.driver,10).until(lambda driver:self.driver.find_element_by_css_selector("._1y306T._2ynKud"))
print("cell exist")
sleep(2)
cell_change.send_keys("1")
'''
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 code:
'''
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()
# cell_change = WebDriverWait(self.driver,20).until(EC.presence_of_element_located((By.CLASS_NAMES,"_1y306T _2ynKud")))
cell_change = WebDriverWait(self.driver,10).until(lambda driver:self.driver.find_element_by_css_selector("._1y306T._2ynKud"))
print("cell exist")
sleep(2)
cell_change.send_keys("1")
'''