seleniumbase / SeleniumBase

📊 Python's all-in-one framework for web crawling, scraping, testing, and reporting. Supports pytest. UC Mode provides stealth. Includes many tools.
https://seleniumbase.io
MIT License
4.46k stars 910 forks source link

Unable to pass cloudflare using UC Mode #2668

Closed flairekq closed 3 months ago

flairekq commented 3 months ago

Hi, I tried the codes from raw_form_turnstile.py it passes the Cloudflare however when I modify the URL to https://thaiticketmajor.com/concert/ and tries to sign in, it keeps failing Cloudflare with error code of 600010.

flairekq commented 3 months ago

The code I'm using:

from seleniumbase import SB

with SB(uc=True, test=True) as sb:
    sb.driver.uc_open_with_reconnect("https://www.thaiticketmajor.com/concert/", 3)
    sb.highlight_click("button.btn-signin")
    sb.switch_to_frame('iframe[src*="challenge"]')
    sb.driver.uc_click("span.mark")
mdmintz commented 3 months ago

You have to use driver.uc_click(selector) whenever going to a screen that has a CAPTCHA waiting for you. (You used highlight_click(selector) instead, which would get you detected.)

This worked:

from seleniumbase import SB

with SB(uc=True, test=True) as sb:
    sb.driver.uc_open_with_reconnect("https://www.thaiticketmajor.com/concert/", 4)
    sb.driver.uc_click("button.btn-signin", 4)

    breakpoint()