Skip to content

Commit

Permalink
Merge pull request #2963 from seleniumbase/update-uc-mode-captcha-bypass
Browse files Browse the repository at this point in the history
Update UC Mode CAPTCHA-bypass
  • Loading branch information
mdmintz authored Jul 25, 2024
2 parents 4007c95 + 7a0cff9 commit 645b126
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion seleniumbase/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# seleniumbase package
__version__ = "4.29.1"
__version__ = "4.29.2"
23 changes: 21 additions & 2 deletions seleniumbase/core/browser_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ def _on_a_cf_turnstile_page(driver):
source = driver.get_page_source()
if (
'data-callback="onCaptchaSuccess"' in source
or "cf-turnstile-wrapper" in source
or "cf-turnstile-" in source
):
return True
return False
Expand Down Expand Up @@ -802,6 +802,17 @@ def _uc_gui_click_captcha(
else:
visible_iframe = False
if (
frame != "iframe"
and driver.is_element_present('[name*="cf-turnstile-"]')
and driver.is_element_present("%s div[style]" % frame)
):
frame = "%s div[style]" % frame
elif (
driver.is_element_present('[name*="cf-turnstile-"]')
and driver.is_element_present("div.spacer div[style]")
):
frame = "div.spacer div[style]"
elif (
frame != "iframe"
and driver.is_element_present(
"%s .cf-turnstile-wrapper" % frame
Expand Down Expand Up @@ -981,6 +992,11 @@ def uc_gui_handle_cf(driver, frame="iframe"):
'[data-callback="onCaptchaSuccess"]'
):
frame = '[data-callback="onCaptchaSuccess"]'
elif (
driver.is_element_present('[name*="cf-turnstile-"]')
and driver.is_element_present("div.spacer div[style]")
):
frame = "div.spacer div[style]"
else:
return
if not is_in_frame or needs_switch:
Expand All @@ -1000,7 +1016,10 @@ def uc_gui_handle_cf(driver, frame="iframe"):
pyautogui.press("\t")
time.sleep(0.02)
active_element_css = js_utils.get_active_element_css(driver)
if active_element_css == "div.cf-turnstile-wrapper":
if (
active_element_css == "div.cf-turnstile-wrapper"
or active_element_css.startswith("div#PYMIw2")
):
found_checkbox = True
break
time.sleep(0.02)
Expand Down

0 comments on commit 645b126

Please sign in to comment.