-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainBot.py
More file actions
44 lines (30 loc) · 1.2 KB
/
mainBot.py
File metadata and controls
44 lines (30 loc) · 1.2 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
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
load_dotenv()
#gets the path to the chromedriver
PATH = "C:\Program Files (x86)\chromedriver.exe"
driver = webdriver.Chrome(PATH)
#goes to the website
driver.get("https://humanbenchmark.com/tests/number-memory")
#sets the wait time
almostInf = 10000**10000
while True:
try:
#looks for the number displayed
numberValue = WebDriverWait(driver,almostInf).until(
EC.presence_of_element_located((By.CLASS_NAME,"big-number"))
)
#gets the number displayed
value = numberValue.text
#looks for the input field
element = WebDriverWait(driver, almostInf).until(
EC.presence_of_element_located((By.TAG_NAME, "input"))
)
#sends the value into the input field
#presses first enter to submit the value and then presses enter again to cotinue
element.send_keys(value, Keys.RETURN, Keys.RETURN)
except:
break