MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / __click_captcha

Method __click_captcha

seleniumbase/core/sb_cdp.py:2429–2612  ·  view source on GitHub ↗

Uses PyAutoGUI unless use_cdp == True

(self, use_cdp=False)

Source from the content-addressed store, hash-verified

2427 self.__click_captcha(use_cdp=False)
2428
2429 def __click_captcha(self, use_cdp=False):
2430 """Uses PyAutoGUI unless use_cdp == True"""
2431 time.sleep(0.075)
2432 self.loop.run_until_complete(self.page.wait(0.1))
2433 time.sleep(0.025)
2434 source = self.get_page_source()
2435 if self._on_a_cf_turnstile_page(source):
2436 pass
2437 elif self._on_a_g_recaptcha_page(source):
2438 result = self.__gui_click_recaptcha(use_cdp)
2439 return result
2440 elif self._on_an_incapsula_hcaptcha_page():
2441 result = self.__cdp_click_incapsula_hcaptcha()
2442 return result
2443 elif self._on_a_datadome_slider_page():
2444 result = self.__gui_slide_datadome_captcha()
2445 return result
2446 elif self._on_a_friendly_captcha_page():
2447 result = self.__gui_click_friendly_captcha(use_cdp)
2448 return result
2449 else:
2450 return False
2451 selector = None
2452 if self.is_element_present('[class="cf-turnstile"]'):
2453 selector = '[class="cf-turnstile"]'
2454 elif self.is_element_present("#challenge-form div > div"):
2455 selector = "#challenge-form div > div"
2456 elif self.is_element_present('[style="display: grid;"] div div'):
2457 selector = '[style="display: grid;"] div div'
2458 time.sleep(0.025)
2459 self.set_attributes(selector, "style", "text-align: left;")
2460 time.sleep(0.025)
2461 elif self.is_element_present("[class*=spacer] + div div"):
2462 selector = '[class*=spacer] + div div'
2463 elif self.is_element_present(".spacer div:not([class])"):
2464 selector = ".spacer div:not([class])"
2465 elif self.is_element_present('[data-testid*="challenge-"] div'):
2466 selector = '[data-testid*="challenge-"] div'
2467 elif self.is_element_present("div#turnstile-widget div:not([class])"):
2468 selector = "div#turnstile-widget div:not([class])"
2469 elif self.is_element_present("ngx-turnstile div:not([class])"):
2470 selector = "ngx-turnstile div:not([class])"
2471 elif self.is_element_present(
2472 'form div:not([class]):has(input[name*="cf-turn"])'
2473 ):
2474 selector = 'form div:not([class]):has(input[name*="cf-turn"])'
2475 elif self.is_element_present("body > div#check > div:not([class])"):
2476 selector = "body > div#check > div:not([class])"
2477 elif self.is_element_present(".cf-turnstile-wrapper"):
2478 selector = ".cf-turnstile-wrapper"
2479 elif self.is_element_present('[id*="turnstile"] div:not([class])'):
2480 selector = '[id*="turnstile"] div:not([class])'
2481 elif self.is_element_present('[class*="turnstile"] div:not([class])'):
2482 selector = '[class*="turnstile"] div:not([class])'
2483 elif self.is_element_present("iframe[data-hcaptcha-widget-id]"):
2484 selector = "iframe[data-hcaptcha-widget-id]"
2485 elif self.is_element_present('[data-callback="onCaptchaSuccess"]'):
2486 selector = '[data-callback="onCaptchaSuccess"]'

Callers 3

solve_captchaMethod · 0.95
click_captchaMethod · 0.95
gui_click_captchaMethod · 0.95

Tested by

no test coverage detected