I using python 3 and web scraping via selenium
I want when I type captcha character in input text after 5 character automatic click on login button
I using a code look like this:
driver.find_element_by_id("Username").send_keys('user')
driver.find_element_by_id("Password").send_keys('pwd')
## driver.find_element_by_id("login_captcha").send_keys(captcha) Here I typing capctha with hand and I dont want using code
WebDriverWait(driver, 10).until() # Here I dont' know how can waiting until I fixed 5 character it doing to next line
driver.find_element_by_name("button").click()
but I don't know how can check do it !
Assuming mentioned input field looks like
<input id="login_captcha>
You can try below code to wait until 5 characters entered in input field:
WebDriverWait(driver, 10).until(lambda driver: len(driver.find_element_by_id("login_captcha").get_attribute("value")) == 5)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With