Skip to content

UC Mode Tab + Spacebar (with reload as needed) #3132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.7"
__version__ = "4.30.8"
22 changes: 18 additions & 4 deletions seleniumbase/core/browser_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -1188,8 +1188,10 @@ def _uc_gui_handle_captcha_(driver, frame="iframe", ctype=None):
for i in range(10):
pyautogui.hotkey("shift", "tab")
time.sleep(0.027)
tab_count = 0
for i in range(34):
pyautogui.press("\t")
tab_count += 1
time.sleep(0.027)
active_element_css = js_utils.get_active_element_css(driver)
if (
Expand All @@ -1198,6 +1200,7 @@ def _uc_gui_handle_captcha_(driver, frame="iframe", ctype=None):
or (special_form and active_element_css.endswith(" div"))
):
found_checkbox = True
sb_config._saved_cf_tab_count = tab_count
break
time.sleep(0.02)
if not found_checkbox:
Expand All @@ -1207,11 +1210,22 @@ def _uc_gui_handle_captcha_(driver, frame="iframe", ctype=None):
driver.switch_to.default_content()
except Exception:
return
driver.disconnect()
try:
if (
driver.is_element_present(".footer .clearfix .ray-id")
and hasattr(sb_config, "_saved_cf_tab_count")
and sb_config._saved_cf_tab_count
):
driver.uc_open_with_disconnect(driver.current_url, 3.8)
try:
for i in range(sb_config._saved_cf_tab_count):
pyautogui.press("\t")
time.sleep(0.027)
pyautogui.press(" ")
except Exception:
pass
else:
driver.disconnect()
pyautogui.press(" ")
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 Down