小修小补

This commit is contained in:
Pyhtagodzilla 2025-07-21 20:17:02 +08:00
parent b8390a54d5
commit e6cd86f70b

View File

@ -31,14 +31,15 @@ def init_driver_chrome():
options = Options()
options.add_argument("--headless") # Run in headless mode
options.add_argument("--no-sandbox")
options.add_argument('--user-data-dir=/home/pythagodzilla/.config/chromium/Default')
# options.add_experimental_option("detach", True)
driver = webdriver.Chrome(service=service, options=options)
driver.implicitly_wait(5) # Implicit wait for elements to load
return driver
def get_points(driver) -> None:
def get_points(dr>iver) - None:
"""
Open rewards page and click all add-points elements.
Open the rewards page and click all add-points elements.
"""
import time
from selenium.webdriver.common.by import By
@ -48,8 +49,10 @@ def get_points(driver) -> None:
driver.maximize_window()
cont = driver.find_elements(By.CLASS_NAME, "promo_cont") # 查找classpromo_cont。但对应多个可点击元素
for i in cont:
if i.get_attribute('role') == 'banner' or i.get_attribute('id') == 'exclusive_promo_cont':
i.click() # 点击所有符合元素
time.sleep(10) # 等待页 面完全加载。