This commit is contained in:
2025-11-21 00:05:00 +08:00
parent d3190e3424
commit ffc3fc3092

View File

@@ -20,7 +20,7 @@ class Auto:
def solve_cloudflare(self): def solve_cloudflare(self):
tab = self.browser.latest_tab tab = self.browser.latest_tab
for _ in range(5): for _ in range(5):
self.tab.wait(0.5) self.tab.wait(1)
try: try:
shadow1 = tab.ele( shadow1 = tab.ele(
'x://*[@name="cf-turnstile-response"]').parent().shadow_root 'x://*[@name="cf-turnstile-response"]').parent().shadow_root
@@ -31,16 +31,16 @@ class Auto:
if shadow2: if shadow2:
logger.debug("找到Cloudflare iframe body shadow root") logger.debug("找到Cloudflare iframe body shadow root")
status = shadow2.ele( status = shadow2.ele(
'x://span[text()="Verifying..."]', timeout=0.5) 'x://span[text()="Verifying..."]', timeout=1)
if status: if status:
tab.wait(3) tab.wait(3)
status = shadow2.ele( status = shadow2.ele(
'x://span[text()="Success!"]', timeout=0.5) 'x://span[text()="Success!"]', timeout=1)
if status: if status:
logger.debug("Cloudflare验证成功") logger.debug("Cloudflare验证成功")
return True return True
checkbox = shadow2.ele( checkbox = shadow2.ele(
'x://input[@type="checkbox"]', timeout=0.5) 'x://input[@type="checkbox"]', timeout=1)
if checkbox: if checkbox:
checkbox.click() checkbox.click()
logger.debug("点击Cloudflare复选框") logger.debug("点击Cloudflare复选框")