Unable to Click on Cloudflare Challenge Captcha! #3427
-
Hey, Thanks for the useful seleniumbase. I want to scrape site but it has cloudflare challenge but location of the captcha isn't default you can see the image below. Html: My code:
I tried: ~ I have tried --debug with uc_gui_click_x_y mode to detect the location but its not valid its automatically clicking and gives me wrong coordinates
Note: if you want to test you can use low quality proxy or vpn |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
When the CF Turnstile isn't in the usual location, use from seleniumbase import SB
with SB(uc=True, test=True, ad_block=True) as sb:
url = "https://www.glassdoor.com/Reviews/index.htm"
sb.activate_cdp_mode(url)
sb.sleep(2)
cf_grid = '[style="display: grid;"]'
cf_shadow = "%s div div" % cf_grid
cf_new_style = "display: grid; width: 300px;"
cf_new_shadow = '[style="%s"] div div' % cf_new_style
sb.uc_gui_click_captcha()
if sb.is_element_visible(cf_shadow):
sb.cdp.set_attributes(cf_grid, "style", cf_new_style)
sb.cdp.gui_click_element(cf_new_shadow)
sb.sleep(2)
sb.cdp.highlight('[data-test="global-nav-glassdoor-logo"]')
sb.cdp.highlight('[data-test="site-header-companies"]')
sb.cdp.highlight('[data-test="search-button"]')
sb.cdp.highlight('[data-test="sign-in-button"]')
sb.cdp.highlight('[data-test="company-search-autocomplete"]') It's possible I may implement something like that directly into |
Beta Was this translation helpful? Give feedback.
When the CF Turnstile isn't in the usual location, use
sb.cdp.gui_click_element(selector)
.Sometimes that requires other modifications, like below: