Код: Выделить всё
# config holds selector strings for all needed elements
config = load_playwright_config()
# verification code sent by mail
verfication_code = ...
# entering verification code works
await page.fill(config['verification_code_selector'], verification_code)
# checking the remember me checkbox is optional (but fails)
try:
print("Checking 'Remember me' checkbox...")
await page.wait_for_selector(config['remember_me_selector'], timeout=5000)
await page.check(config['remember_me_selector'])
print("'Remember me' checkbox checked successfully")
except PlaywrightTimeoutError:
print("Warning: 'Remember me' checkbox not found within timeout, continuing...")
except Exception as e:
print(f"Warning: Failed to check 'Remember me' checkbox: {e}, continuing...")
# submitting verification code form fails
print("Submitting verification code...")
await page.click(config['submit_verification_selector'])
try:
await page.wait_for_selector(config['success_selector'], timeout=10000)
print("Login successful!")
except PlaywrightTimeoutError:
print("Login failed: Success selector not found")
Код: Выделить всё
Checking 'Remember me' checkbox...
Warning: 'Remember me' checkbox not found within timeout, continuing...
Submitting verification code...
Waiting for login success indicator...
Login failed: Success selector not found
Что вызывает эту проблему и как ее исправить?

Подробнее здесь: https://stackoverflow.com/questions/798 ... t-and-back
Мобильная версия