For example, when writing "Hello", I do this to put a random wait time between 0.03 and 0.2 seconds for each character to be typed.
Is it possible to do write with a single send_keys function with a random wait time between 0.03 and 0.2 seconds to write each character?
import random
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
driver = webdriver.Chrome(executable_path='C:/Users/X/chromedriver.exe',chrome_options=chrome_options)
driver.get ('https://example.com/login')
driver.find_element_by_name("session[username_or_email]").send_keys('H')
time.sleep(random.uniform(0.03,0.2))
driver.find_element_by_name("session[username_or_email]").send_keys('e')
time.sleep(random.uniform(0.03,0.2))
driver.find_element_by_name("session[username_or_email]").send_keys('l')
time.sleep(random.uniform(0.03,0.2))
driver.find_element_by_name("session[username_or_email]").send_keys('l')
time.sleep(random.uniform(0.03,0.2))
driver.find_element_by_name("session[username_or_email]").send_keys('o')
time.sleep(random.uniform(0.03,0.2))
Aucun commentaire:
Enregistrer un commentaire