From 0160a135ae9aaecda43f155d383d0a44438b54c7 Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Thu, 12 Sep 2024 14:47:16 -0400 Subject: [PATCH 1/2] Update UC Mode --- seleniumbase/core/browser_launcher.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/seleniumbase/core/browser_launcher.py b/seleniumbase/core/browser_launcher.py index 73faacce..28c4185f 100644 --- a/seleniumbase/core/browser_launcher.py +++ b/seleniumbase/core/browser_launcher.py @@ -900,6 +900,11 @@ def _uc_gui_click_captcha( and driver.is_element_present("%s div" % frame) ): frame = "%s div" % frame + elif ( + driver.is_element_present('[name*="cf-turnstile-"]') + and driver.is_element_present('[class*=spacer] + div div') + ): + frame = '[class*=spacer] + div div' elif ( driver.is_element_present('[name*="cf-turnstile-"]') and driver.is_element_present("div.spacer div") @@ -975,13 +980,16 @@ def _uc_gui_click_captcha( driver.switch_to.default_content() except Exception: return - driver.disconnect() - try: - if x and y: - sb_config._saved_cf_x_y = (x, y) - _uc_gui_click_x_y(driver, x, y, timeframe=0.95) - except Exception: - pass + if x and y: + sb_config._saved_cf_x_y = (x, y) + if driver.is_element_present(".footer .clearfix .ray-id"): + driver.uc_open_with_disconnect(driver.current_url, 3.8) + else: + driver.disconnect() + try: + _uc_gui_click_x_y(driver, x, y, timeframe=0.54321) + except Exception: + pass reconnect_time = (float(constants.UC.RECONNECT_TIME) / 2.0) + 0.6 if IS_LINUX: reconnect_time = constants.UC.RECONNECT_TIME + 0.2 @@ -991,7 +999,7 @@ def _uc_gui_click_captcha( caught = False if ( driver.is_element_present(".footer .clearfix .ray-id") - and not driver.is_element_present("#challenge-success-text") + and not driver.is_element_visible("#challenge-success-text") ): blind = True caught = True @@ -1214,7 +1222,7 @@ def _uc_gui_handle_captcha(driver, frame="iframe", ctype=None): _uc_gui_handle_captcha_(driver, frame=frame, ctype=ctype) if ( driver.is_element_present(".footer .clearfix .ray-id") - and not driver.is_element_present("#challenge-success-text") + and not driver.is_element_visible("#challenge-success-text") ): driver.uc_open_with_reconnect(driver.current_url, 3.8) _uc_gui_handle_captcha_(driver, frame=frame, ctype=ctype) From a5ada230999555f3467a2de33219527888cd912c Mon Sep 17 00:00:00 2001 From: Michael Mintz Date: Thu, 12 Sep 2024 14:47:32 -0400 Subject: [PATCH 2/2] Version 4.30.7 --- seleniumbase/__version__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seleniumbase/__version__.py b/seleniumbase/__version__.py index fad70e1f..eddb3e60 100755 --- a/seleniumbase/__version__.py +++ b/seleniumbase/__version__.py @@ -1,2 +1,2 @@ # seleniumbase package -__version__ = "4.30.6" +__version__ = "4.30.7"