如何等待用户单击以继续执行剩余的自动化步骤



我有一个自动填写表格的代码。我想等待用户完成阅读通知,然后手动单击以继续自动

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....

要等待用户完成阅读通知并手动单击,然后继续自动化,一种优雅的方法是等待用户按下控制台上的RETURN键,如下所示:

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....

相关内容

  • 没有找到相关文章