啊,一直卡在 Turnstile
我是py
import undetected_chromedriver as uc
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
username = ' '
password = ' '
another_username = '[email protected]' # Replace with the actual username
another_password = 'password' # Replace with the actual password
# Setup undetected Chromedriver
options = uc.ChromeOptions()
# options.add_argument("--headless") # Uncomment if you want to run headless
driver = uc.Chrome(options=options)
# Navigate to the login page
driver.get("https://token.oaifree.com/auth")
# Login process
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.ID, "login-account-name"))).send_keys(username)
driver.find_element(By.ID, "login-account-password").send_keys(password + Keys.RETURN)
# Wait for and click some button (example with class name)
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//a[contains(@class, 'bg-red-500')]"))).click()
# Wait for new form and enter another username
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.ID, "txtUsername"))).send_keys(another_username)
# Enter another password
driver.find_element(By.ID, "txtPassword").send_keys(another_password)
# Check the checkbox
checkbox = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input[type='checkbox']")))
checkbox.click()
# Wait for success circle to be clickable and click the get access token button
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "circle.success-circle")))
driver.find_element(By.ID, "btnGetAccessToken").click()