-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnumber_memory.py
More file actions
29 lines (24 loc) · 906 Bytes
/
Copy pathnumber_memory.py
File metadata and controls
29 lines (24 loc) · 906 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
25
26
27
28
29
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import time
score = 0
chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option("detach", True)
driver = webdriver.Chrome(options=chrome_options)
driver.get("https://humanbenchmark.com/tests/number-memory")
start = driver.find_element(By.XPATH, '//*[@id="root"]/div/div[4]/div[1]/div/div/div/div[3]/button')
time.sleep(2)
start.click()
while True:
if score == 25:
print("Sorry, I am currently capped at 25 digits only!")
break
num = driver.find_element(By.CSS_SELECTOR, ".big-number").text
time.sleep(int(3 + score * 0.75))
type_in = driver.find_element(By.CSS_SELECTOR, 'input[pattern="[0-9]*"]')
type_in.send_keys(num)
time.sleep(1)
type_in.send_keys(Keys.ENTER, Keys.ENTER)
time.sleep(1)
score += 1