feat: 8.0.2.1版本支持QQ邮箱获取验证码

This commit is contained in:
huangzhenpc
2025-02-10 16:59:21 +08:00
parent d1232d7d3b
commit 241b1f2413
8 changed files with 68 additions and 105 deletions

View File

@@ -230,13 +230,16 @@ def handle_verification_code(tab, email_handler):
while retry_count < max_retries:
try:
print(f"\n[调试] 开始第 {retry_count + 1} 次验证码处理")
if tab.ele("Account Settings", timeout=3):
print_status("注册成功 - 已进入账户设置页面", "success")
return True
if tab.ele("@data-index=0", timeout=3):
print_status("正在获取邮箱验证码...")
print(f"[调试] 开始获取验证码{email_handler}")
code = get_verification_code_with_retry(email_handler)
print(f"[调试] 获取到的验证码: {code}")
if not code:
print_status("获取验证码失败", "error")
return False
@@ -246,6 +249,7 @@ def handle_verification_code(tab, email_handler):
# 快速输入验证码
for i, digit in enumerate(code):
print(f"[调试] 输入第 {i+1} 位: {digit}")
tab.ele(f"@data-index={i}").input(digit)
time.sleep(0.1)
@@ -254,10 +258,12 @@ def handle_verification_code(tab, email_handler):
return True
retry_count += 1
print(f"[调试] 未找到验证码输入框,重试次数: {retry_count}")
time.sleep(1)
except Exception as e:
print_status(f"验证码处理过程出错: {str(e)}", "error")
print(f"[调试] 错误详情: {str(e)}")
retry_count += 1
if retry_count < max_retries:
time.sleep(1)
@@ -760,8 +766,8 @@ if __name__ == "__main__":
print_status("浏览器初始化完成", "success")
print_status("正在初始化邮箱验证模块...")
email_handler = EmailVerificationHandler()
print_step_header("配置信息")
login_url = "https://authenticator.cursor.sh"
@@ -779,6 +785,11 @@ if __name__ == "__main__":
print_status(f"生成的邮箱账号: {account}")
auto_update_cursor_auth = True
print_status("正在初始化邮箱验证模块...")
# 使用生成的account初始化email_handler
email_handler = EmailVerificationHandler(account=account)
print_status("初始化邮箱验证模块成功", "success")
tab = browser.latest_tab
tab.run_js("try { turnstile.reset() } catch(e) { }")