我正在使用Selenium网络驱动程序来完成一个表格,但想在打字时模拟人类行为,而不是自动填充我的值。
例如:
driver.find_element_by_id("Address").send_keys("Anthony Street 35th")
我想模拟输入Anthony Street时的人类行为,每次击键之间随机暂停时间。
这能做到吗?
只需通过循环一次发送一封信。
address = 'Anthony Street 35'
address_elem = driver.find_element_by_id("Address")
for letter in address:
time.sleep(random.randint(1, 3)) # sleep between 1 and 3 seconds
address_elem.send_keys(letter)