I am coding bots to automate the human benchmark test, this is out of education to learn coding and webscraping. To clarify this site has no competition and I will only do it to learn coding and because I am bored. I want to do the typing test but it won't work for me. I have followed a tutorial and it still won't work. Does anyone know how I can make it work?
code:
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
import keyboard
import time
import selenium
# button to start program
start_button = 'esc'
# setting up Selenium browser
browser = webdriver.Chrome()
browser.get("https://humanbenchmark.com/tests/typing")
# wait for us to start program
while True:
if keyboard.is_pressed(start_button):
break
# find elements that contain text
tic = time.perf_counter()
elements = browser.find_elements_by_class_name("incomplete")
# get complete text string for us to type
text = ""
for element in elements:
element_text = element.text
text += element_text if len(element_text) > 0 else ' '
# measure how long everything took because Selenium is slow (optional)
toc = time.perf_counter()
print(toc - tic)
# write the text
keyboard.write(text)```