Skip to content

Commit c3fbdb9

Browse files
authored
Merge pull request #3129 from seleniumbase/uc-mode-reload-click
UC Mode: Reload & Click, as needed
2 parents a74b443 + a5ada23 commit c3fbdb9

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

seleniumbase/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# seleniumbase package
2-
__version__ = "4.30.6"
2+
__version__ = "4.30.7"

seleniumbase/core/browser_launcher.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,11 @@ def _uc_gui_click_captcha(
900900
and driver.is_element_present("%s div" % frame)
901901
):
902902
frame = "%s div" % frame
903+
elif (
904+
driver.is_element_present('[name*="cf-turnstile-"]')
905+
and driver.is_element_present('[class*=spacer] + div div')
906+
):
907+
frame = '[class*=spacer] + div div'
903908
elif (
904909
driver.is_element_present('[name*="cf-turnstile-"]')
905910
and driver.is_element_present("div.spacer div")
@@ -975,13 +980,16 @@ def _uc_gui_click_captcha(
975980
driver.switch_to.default_content()
976981
except Exception:
977982
return
978-
driver.disconnect()
979-
try:
980-
if x and y:
981-
sb_config._saved_cf_x_y = (x, y)
982-
_uc_gui_click_x_y(driver, x, y, timeframe=0.95)
983-
except Exception:
984-
pass
983+
if x and y:
984+
sb_config._saved_cf_x_y = (x, y)
985+
if driver.is_element_present(".footer .clearfix .ray-id"):
986+
driver.uc_open_with_disconnect(driver.current_url, 3.8)
987+
else:
988+
driver.disconnect()
989+
try:
990+
_uc_gui_click_x_y(driver, x, y, timeframe=0.54321)
991+
except Exception:
992+
pass
985993
reconnect_time = (float(constants.UC.RECONNECT_TIME) / 2.0) + 0.6
986994
if IS_LINUX:
987995
reconnect_time = constants.UC.RECONNECT_TIME + 0.2
@@ -991,7 +999,7 @@ def _uc_gui_click_captcha(
991999
caught = False
9921000
if (
9931001
driver.is_element_present(".footer .clearfix .ray-id")
994-
and not driver.is_element_present("#challenge-success-text")
1002+
and not driver.is_element_visible("#challenge-success-text")
9951003
):
9961004
blind = True
9971005
caught = True
@@ -1214,7 +1222,7 @@ def _uc_gui_handle_captcha(driver, frame="iframe", ctype=None):
12141222
_uc_gui_handle_captcha_(driver, frame=frame, ctype=ctype)
12151223
if (
12161224
driver.is_element_present(".footer .clearfix .ray-id")
1217-
and not driver.is_element_present("#challenge-success-text")
1225+
and not driver.is_element_visible("#challenge-success-text")
12181226
):
12191227
driver.uc_open_with_reconnect(driver.current_url, 3.8)
12201228
_uc_gui_handle_captcha_(driver, frame=frame, ctype=ctype)

0 commit comments

Comments
 (0)