-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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.
Image:
Html:
My code:
from seleniumbase import SB
with SB(uc=True) as sb:
url = "https://glassdoor.com/job"
sb.uc_open_with_reconnect(url, 4)
sb.uc_gui_click_captcha()
sb.sleep(20)
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
~ I also tried this but its for turnstile i think, its clicking right but not bypassing:
sb.uc_gui_handle_captcha()
sb.set_messenger_theme(location="top-left")
Note: if you want to test you can use low quality proxy or vpn
Thanks
Beta Was this translation helpful? Give feedback.
All reactions
When the CF Turnstile isn't in the usual location, use sb.cdp.gui_click_element(selector)
.
Sometimes that requires other modifications, like below:
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)...
Replies: 1 comment
-
When the CF Turnstile isn't in the usual location, use sb.cdp.gui_click_element(selector)
.
Sometimes that requires other modifications, like below:
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 sb.uc_gui_click_captcha()
in the near future.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1