username = '你的蝦皮帳號'
password = '密碼'
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
s=Service(ChromeDriverManager().install())
driver = webdriver.Chrome(service=s)
driver.get('https://shopee.tw/buyer/login?next=https%3A%2F%2Fshopee.tw%2Fshopee-coins')
driver.find_element(By.CSS_SELECTOR, 'input[name="loginKey"]').send_keys(username)
driver.find_element(By.CSS_SELECTOR, 'input[name="password"]').send_keys(password)
import time
time.sleep(5)
driver.find_element(By.XPATH, '//button[text()="登入"]').click()
time.sleep(10)
driver.find_element(By.CSS_SELECTOR, 'button[class^="pcmall-dailycheckin"]').click()
下一步,將上面的程式儲存檔案,再用作業系統的排程功能設定每日固定時間執行下面的命令。
python C:\Users\wells\Desktop\Python\shopee-coins.py