Home > Software design >  How to wait for the user to click to continue the remaining automation steps
How to wait for the user to click to continue the remaining automation steps

Time:08-24

I have a code to automate the filling of a form. I want to wait for the user to finish reading the notice and click manually to then continue the automation

codigopostal = driver.find_element(By.NAME, 'codigoPostal')
codigopostal.clear()
codigopostal.send_keys(line[4])
time.sleep(2)
enter = driver.find_element(By.XPATH, "/html/body/div[1]/div[2]/section/form/div[2]/div[2]/table[2]/tbody/tr/td[1]/input")
enter.click() # I want to wait for the user to manually click
#continue with autofill form code....
 

CodePudding user response:

To wait for the user to finish reading the notice and click manually and then continue the automation, an elegant approach would be to wait for the user to press the RETURN key on the console as follows:

codigopostal = driver.find_element(By.NAME, 'codigoPostal')
codigopostal.clear()
codigopostal.send_keys(line[4])
time.sleep(2)
enter = driver.find_element(By.XPATH, "/html/body/div[1]/div[2]/section/form/div[2]/div[2]/table[2]/tbody/tr/td[1]/input")
input('Press RETURN key when finished reading')
#continue with autofill form code....
  • Related