Skip to content

Commit

Permalink
Merge pull request #3129 from seleniumbase/uc-mode-reload-click
Browse files Browse the repository at this point in the history
UC Mode: Reload & Click, as needed
  • Loading branch information
mdmintz authored Sep 12, 2024
2 parents a74b443 + a5ada23 commit c3fbdb9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 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.30.6"
__version__ = "4.30.7"
26 changes: 17 additions & 9 deletions seleniumbase/core/browser_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c3fbdb9

Please sign in to comment.