-
Notifications
You must be signed in to change notification settings - Fork 0
/
verbal-memory.js
37 lines (36 loc) · 1.18 KB
/
verbal-memory.js
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
verbalMemory = document.querySelector('.verbal-memory-test');
startButton = verbalMemory.querySelector('.test-group:last-child .hero-button');
if (startButton) {
startButton.click();
} else {
console.log("No start button found. Are you on the correct page?\nhttps://www.humanbenchmark.com/tests/verbal-memory");
}
setTimeout(function(){
seenButton = verbalMemory.querySelector('.test-group:last-child .hero-button:first-child').children[0];
newButton = verbalMemory.querySelector('.test-group:last-child .hero-button:last-child').children[1];
wordArray = [];
setInterval(function () {
wordContainer = verbalMemory.querySelector('');
console.log('--');
console.log(wordArray);
console.log(wordContainer.textContent);
console.log('--');
if (wordArray.length) {
seen = false;
wordArray.forEach(function (word) {
if (word === wordContainer.textContent) {
seen = true;
}
});
if (seen) {
seenButton.click();
} else {
wordArray.push(wordContainer.textContent);
newButton.click();
}
} else {
wordArray.push(wordContainer.textContent);
newButton.click();
}
}, 50);
}, 1000);