Spaces:
Paused
Paused
fix: 适配 OpenAI 多种首页变体(A/B 测试)
Browse filesOpenAI 对不同 IP/地区展示不同首页:
- 变体 A: 直接有邮箱输入框(Log in or sign up)
- 变体 B: Get started + Sign up for free + 邮箱在下方
- 变体 C: Get started + Continue with Google + More options(邮箱被折叠)
现在按优先级尝试:More options → Sign up for free → Sign up → Log in,
每次点击后检查邮箱输入框是否出现。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
746 unmodified lines747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776746 unmodified linesscreenshot(page, "direct_01_login_page.png")# 可能是首页(Get started)或登录页,需要先进入注册流程try:# 首先检查是否已经有邮箱输入框(新版统一页面)email_visible = page.locator('input[name="email"], input[type="email"], input[placeholder*="email" i], ''input[placeholder*="Email" i], input[autocomplete="email"]').first.is_visible(timeout=3000)if not email_visible:# 尝试点击各种注册/Sign up 按钮for sel in ['a:has-text("Sign up for free")','button:has-text("Sign up for free")','a:has-text("Sign up")','button:has-text("Sign up")','a:has-text("注册")','button:has-text("注册")',]:try:btn = page.locator(sel).firstif btn.is_visible(timeout=1000):logger.info("[直接注册] 点击注册按钮: %s", sel)btn.click()time.sleep(5)breakexcept Exception:continueexcept Exception:746 unmodified lines747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783746 unmodified linesscreenshot(page, "direct_01_login_page.png")# OpenAI 首页有多种 A/B 测试变体,需要逐步找到邮箱输入框_email_selectors = ('input[name="email"], input[type="email"], input[id="email"], ''input[autocomplete="email"], input[autocomplete="username"], ''input[placeholder*="email" i], input[placeholder*="Email" i]')try:email_visible = page.locator(_email_selectors).first.is_visible(timeout=3000)if not email_visible:# 尝试按优先级点击各种按钮来展开/跳转到邮箱输入for sel, desc in [('button:has-text("More options")', "More options"),('button:has-text("更多选项")', "更多选项"),('a:has-text("Sign up for free")', "Sign up for free"),('button:has-text("Sign up for free")', "Sign up for free"),('a:has-text("Sign up")', "Sign up"),('button:has-text("Sign up")', "Sign up"),('a:has-text("注册")', "注册"),('button:has-text("注册")', "注册"),('a:has-text("Log in")', "Log in"),('button:has-text("Log in")', "Log in"),]:try:btn = page.locator(sel).firstif btn.is_visible(timeout=1000):logger.info("[直接注册] 点击: %s", desc)btn.click()time.sleep(3)# 检查邮箱输入框是否出现了if page.locator(_email_selectors).first.is_visible(timeout=3000):breakexcept Exception:continueexcept Exception:
src/autoteam/manager.py+24-17