在Inglatan网站上处理Cloudflare Turnstile验证
from seleniumbase import Driver
import time
driver = Driver(uc=True)
url = "https://ingatlan.com/35386626"
driver.uc_open_with_reconnect(url, 4)
time.sleep(15)
driver.uc_gui_click_captcha()
time.sleep(60)
我正在使用下面的代码来绕过网站的人机验证(Turnstile),但它陷入循环。脚本点击了复选框,但页面会再次重新加载;在同一会话中手动操作时,验证就能完成。
解决方案
与其强制进行GUI点击,不如让SeleniumBase处理重新连接,并完全原生地通过导航来让Ubderdetected Chromedriver (UC) 有空间处理cookies/tokens,而无需显式操作。
import time
from seleniumbase import Driver
driver = Driver(uc=True, headless=False)
url = "https://ingatlan.com/35386626"
driver.uc_open_with_reconnect(url, reconnect_time=6)
time.sleep(10)
try:
driver.verify_success() # Waits until the anti-bot page disappears
except Exception:
# Fallback: let it click only if verify_success didnt auto-pass
driver.uc_gui_click_captcha()
time.sleep(10)
print("Page title:", driver.title)
driver.quit()
站内所有文章版权归属LeftHeroAI导航站,无授权禁止任何主体转载、抄袭、复制内容,亦不得私自架设镜像站点。一经侵权,本站将通过法律途径追责。