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