From 164f0558860ab2a2c6e7588cc1d839796dff7e87 Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Thu, 25 Jul 2024 16:09:34 -0400 Subject: [PATCH 1/2] Update UC Mode --- seleniumbase/core/browser_launcher.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/seleniumbase/core/browser_launcher.py b/seleniumbase/core/browser_launcher.py index b34d29caaaf..0a22610272e 100644 --- a/seleniumbase/core/browser_launcher.py +++ b/seleniumbase/core/browser_launcher.py @@ -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 @@ -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 @@ -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: @@ -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) From 7a0cff935078dc44aabf0e275962fd91b238f475 Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Thu, 25 Jul 2024 16:10:07 -0400 Subject: [PATCH 2/2] Version 4.29.2 --- seleniumbase/__version__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seleniumbase/__version__.py b/seleniumbase/__version__.py index abdaec6225c..d1b98bd2a16 100755 --- a/seleniumbase/__version__.py +++ b/seleniumbase/__version__.py @@ -1,2 +1,2 @@ # seleniumbase package -__version__ = "4.29.1" +__version__ = "4.29.2"