-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreaction_test.py
More file actions
25 lines (21 loc) · 938 Bytes
/
Copy pathreaction_test.py
File metadata and controls
25 lines (21 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import StaleElementReferenceException, NoSuchElementException
import time
chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option("detach", True)
driver = webdriver.Chrome(options=chrome_options)
driver.get("https://humanbenchmark.com/tests/reactiontime")
time.sleep(2)
driver.find_element(By.XPATH, '//*[@id="root"]/div/div[4]/div[1]/div/div/div/div[2]/div[2]/h2[2]').click()
while True:
prompt = driver.find_element(By.XPATH, '//*[@id="root"]/div/div[4]/div[1]/div/div/div/h1/div')
try:
if prompt.text == 'Click!':
prompt.click()
time.sleep(1)
driver.find_element(By.XPATH, '//*[@id="root"]/div/div[4]/div[1]/div/div/div/h1/div').click()
except StaleElementReferenceException:
continue
except NoSuchElementException:
break