From 4250c6db21df9bf633cecc2206ba277c128d7903 Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Mon, 29 Jul 2024 16:47:20 -0400 Subject: [PATCH 1/2] Handle CAPTCHA updates --- seleniumbase/core/browser_launcher.py | 32 ++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/seleniumbase/core/browser_launcher.py b/seleniumbase/core/browser_launcher.py index b6ebadc647f..79f64eb4eee 100644 --- a/seleniumbase/core/browser_launcher.py +++ b/seleniumbase/core/browser_launcher.py @@ -835,6 +835,16 @@ def _uc_gui_click_captcha( '[data-callback="onCaptchaSuccess"]' ): frame = '[data-callback="onCaptchaSuccess"]' + elif ( + ( + driver.is_element_present('[name*="cf-turnstile-"]') + or driver.is_element_present('[id*="cf-turnstile-"]') + ) + and driver.is_element_present( + 'div > div > [style*="margin"][style*="padding"]' + ) + ): + frame = 'div > div > [style*="margin"][style*="padding"]' else: return if driver.is_element_present('form[class*=center]'): @@ -1007,6 +1017,26 @@ def uc_gui_handle_cf(driver, frame="iframe"): and driver.is_element_present("div.spacer div[style]") ): frame = "div.spacer div[style]" + elif ( + ( + driver.is_element_present('[name*="cf-turnstile-"]') + or driver.is_element_present('[id*="cf-turnstile-"]') + ) + and driver.is_element_present( + 'form div div[style*="margin"][style*="padding"]' + ) + ): + frame = 'form div div[style*="margin"][style*="padding"]' + elif ( + ( + driver.is_element_present('[name*="cf-turnstile-"]') + or driver.is_element_present('[id*="cf-turnstile-"]') + ) + and driver.is_element_present( + 'div > div > [style*="margin"][style*="padding"]' + ) + ): + frame = 'div > div > [style*="margin"][style*="padding"]' else: return if not is_in_frame or needs_switch: @@ -1028,7 +1058,7 @@ def uc_gui_handle_cf(driver, frame="iframe"): active_element_css = js_utils.get_active_element_css(driver) if ( active_element_css.startswith("div.cf-turnstile") - or active_element_css.startswith("div#PYMIw2") + or active_element_css.endswith(" > div" * 2) ): found_checkbox = True break From b5297add51c9c55e1ee4d782b65f080e3c9c46a4 Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Mon, 29 Jul 2024 16:47:36 -0400 Subject: [PATCH 2/2] Version 4.29.4 --- seleniumbase/__version__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seleniumbase/__version__.py b/seleniumbase/__version__.py index 29c985bf92f..2a471a4f252 100755 --- a/seleniumbase/__version__.py +++ b/seleniumbase/__version__.py @@ -1,2 +1,2 @@ # seleniumbase package -__version__ = "4.29.3" +__version__ = "4.29.4"