-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtyping_test.py
More file actions
22 lines (19 loc) · 839 Bytes
/
Copy pathtyping_test.py
File metadata and controls
22 lines (19 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import 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/typing")
time.sleep(2)
while True:
try:
curr_letter = driver.find_element(By.CLASS_NAME, "current")
if not curr_letter.text:
driver.find_element(By.XPATH, '//*[@id="root"]/div/div[4]/div[1]/div/div[2]/div').send_keys(Keys.SPACE)
else:
driver.find_element(By.XPATH, '//*[@id="root"]/div/div[4]/div[1]/div/div[2]/div').send_keys(curr_letter.text)
except NoSuchElementException:
break