-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnumbermemory.py
More file actions
61 lines (40 loc) · 1.29 KB
/
numbermemory.py
File metadata and controls
61 lines (40 loc) · 1.29 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
import time
from pynput.keyboard import Controller, Key
# //div[contains(@class, 'big-number')]
websiteURL = 'https://humanbenchmark.com/tests/number-memory'
driver = webdriver.Firefox()
driver.get(websiteURL)
keyboard = Controller()
# begin button
begin = driver.find_element(By.XPATH, "//button[contains(@class, 'css-de05nr e19owgy710')]")
begin.click()
# find bignumber
number = driver.find_element(By.XPATH, " //div[contains(@class, 'big-number')]")
# for divClass css-1qvtbrk e19owgy78
keyboard.type(str(number))
keyboard.press(Key.enter)
keyboard.release(Key.enter)
# inputClass = driver.find_element(By.XPATH, "//div[contains(@class, 'css-1qvtbrk e19owgy78')]//input")
# looping portion
max = 10
count = 0
while count < max:
time.sleep(1)
while True:
try:
number = driver.find_element(By.XPATH, " //div[contains(@class, 'big-number')]").text
except:
print("Endnum")
break
# break and input number into form
keyboard.type(str(number))
keyboard.press(Key.enter)
keyboard.release(Key.enter)
# set count for score you want
count+=1
time.sleep(15)
driver.quit()
# press begin