Created
January 6, 2021 21:49
-
-
Save painor/a7da9c30322908d10537a9548f5aaadf to your computer and use it in GitHub Desktop.
automation script for https://humanbenchmark.com/tests/reactiontime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
from selenium import webdriver | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.webdriver.support.wait import WebDriverWait | |
driver = webdriver.Chrome() | |
driver.get("https://humanbenchmark.com/tests/reactiontime") | |
input("ready ?") | |
cl = driver.find_element_by_class_name("view-splash") | |
cl.click() | |
def clicker(timer, pause): | |
element = WebDriverWait(driver, 10, poll_frequency=timer).until( | |
EC.visibility_of_element_located((By.CLASS_NAME, "view-go")) | |
) | |
element.click() | |
sleep(pause) | |
element = WebDriverWait(driver, 10, poll_frequency=timer).until( | |
EC.visibility_of_element_located((By.CLASS_NAME, "view-result")) | |
) | |
element.click() | |
while True: | |
try: | |
clicker(0.15, 1.5) # First timer is how fast you want it to be (0.15 = ~150ms). second is how long to wait before starting a new one | |
except Exception as e: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment