Skip to content

Commit 2aa5abe

Browse files
authored
Merge pull request #3132 from seleniumbase/uc-mode-reload-tab-and-click
UC Mode Tab + Spacebar (with reload as needed)
2 parents c3fbdb9 + d25fd4d commit 2aa5abe

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
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.7"
2+
__version__ = "4.30.8"

seleniumbase/core/browser_launcher.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,8 +1188,10 @@ def _uc_gui_handle_captcha_(driver, frame="iframe", ctype=None):
11881188
for i in range(10):
11891189
pyautogui.hotkey("shift", "tab")
11901190
time.sleep(0.027)
1191+
tab_count = 0
11911192
for i in range(34):
11921193
pyautogui.press("\t")
1194+
tab_count += 1
11931195
time.sleep(0.027)
11941196
active_element_css = js_utils.get_active_element_css(driver)
11951197
if (
@@ -1198,6 +1200,7 @@ def _uc_gui_handle_captcha_(driver, frame="iframe", ctype=None):
11981200
or (special_form and active_element_css.endswith(" div"))
11991201
):
12001202
found_checkbox = True
1203+
sb_config._saved_cf_tab_count = tab_count
12011204
break
12021205
time.sleep(0.02)
12031206
if not found_checkbox:
@@ -1207,11 +1210,22 @@ def _uc_gui_handle_captcha_(driver, frame="iframe", ctype=None):
12071210
driver.switch_to.default_content()
12081211
except Exception:
12091212
return
1210-
driver.disconnect()
1211-
try:
1213+
if (
1214+
driver.is_element_present(".footer .clearfix .ray-id")
1215+
and hasattr(sb_config, "_saved_cf_tab_count")
1216+
and sb_config._saved_cf_tab_count
1217+
):
1218+
driver.uc_open_with_disconnect(driver.current_url, 3.8)
1219+
try:
1220+
for i in range(sb_config._saved_cf_tab_count):
1221+
pyautogui.press("\t")
1222+
time.sleep(0.027)
1223+
pyautogui.press(" ")
1224+
except Exception:
1225+
pass
1226+
else:
1227+
driver.disconnect()
12121228
pyautogui.press(" ")
1213-
except Exception:
1214-
pass
12151229
reconnect_time = (float(constants.UC.RECONNECT_TIME) / 2.0) + 0.6
12161230
if IS_LINUX:
12171231
reconnect_time = constants.UC.RECONNECT_TIME + 0.2

0 commit comments

Comments
 (0)