-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVerbalMemory.py
More file actions
35 lines (27 loc) · 935 Bytes
/
VerbalMemory.py
File metadata and controls
35 lines (27 loc) · 935 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
30
31
32
33
34
35
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
import time
# //div[@class="word"]
websiteURL = 'https://humanbenchmark.com/tests/verbal-memory'
driver = webdriver.Firefox()
driver.get(websiteURL)
# select start button
startButton = driver.find_element(By.XPATH, "//button[@class='css-de05nr e19owgy710']")
startButton.click()
buttons = driver.find_elements(By.XPATH, "//button[@class='css-de05nr e19owgy710']")
seenButton = buttons[0]
newButton = buttons[1]
time.sleep(1)
wordSet = {""}
# find word, check if in set, if in set, select seen, otherwise click new
while(True):
word = driver.find_element(By.XPATH, "//div[contains(@class, 'word')]")
print(word)
if word.text in wordSet:
seenButton.click()
else:
wordSet.add(word.text)
newButton.click()
print(len(wordSet))
time.sleep(0.05)