-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathapp.py
More file actions
45 lines (34 loc) · 1.3 KB
/
Copy pathapp.py
File metadata and controls
45 lines (34 loc) · 1.3 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.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
import os
options = Options()
user_data_path = os.path.join(os.getcwd(), "chrome_user_data")
options.add_argument(f"--user-data-dir={user_data_path}")
options.add_argument('--disk-cache-size=1048576') # Limit to 1MB (1MB = 1024*1024)
#options.add_argument("--headless=new") # Uncomment this to run Chrome in headless mode (no UI)
# Launch Chrome using WebDriver Manager
driver = webdriver.Chrome(
service=Service(ChromeDriverManager().install()),
options=options
)
def script():
print("Script has started running...")
# Open the target website
driver.get("https://aternos.org/server/")
print("Opened the Aternos server page.")
button = WebDriverWait(driver, 615).until(
EC.element_to_be_clickable((By.CSS_SELECTOR, ".btn.btn-tiny.btn-success.server-extend-end"))
)
button.click()
print("Button found, clicking it...")
script()
print("recursion called...")
driver.quit()
print("Driver quit, script finished.")
script()