Update UC Mode

This commit is contained in:
Michael Mintz 2024-07-25 16:09:34 -04:00
parent 4007c95f53
commit 164f055886
1 changed files with 21 additions and 2 deletions

View File

@ -725,7 +725,7 @@ def _on_a_cf_turnstile_page(driver):
source = driver.get_page_source() source = driver.get_page_source()
if ( if (
'data-callback="onCaptchaSuccess"' in source 'data-callback="onCaptchaSuccess"' in source
or "cf-turnstile-wrapper" in source or "cf-turnstile-" in source
): ):
return True return True
return False return False
@ -802,6 +802,17 @@ def _uc_gui_click_captcha(
else: else:
visible_iframe = False visible_iframe = False
if ( if (
frame != "iframe"
and driver.is_element_present('[name*="cf-turnstile-"]')
and driver.is_element_present("%s div[style]" % frame)
):
frame = "%s div[style]" % frame
elif (
driver.is_element_present('[name*="cf-turnstile-"]')
and driver.is_element_present("div.spacer div[style]")
):
frame = "div.spacer div[style]"
elif (
frame != "iframe" frame != "iframe"
and driver.is_element_present( and driver.is_element_present(
"%s .cf-turnstile-wrapper" % frame "%s .cf-turnstile-wrapper" % frame
@ -981,6 +992,11 @@ def uc_gui_handle_cf(driver, frame="iframe"):
'[data-callback="onCaptchaSuccess"]' '[data-callback="onCaptchaSuccess"]'
): ):
frame = '[data-callback="onCaptchaSuccess"]' frame = '[data-callback="onCaptchaSuccess"]'
elif (
driver.is_element_present('[name*="cf-turnstile-"]')
and driver.is_element_present("div.spacer div[style]")
):
frame = "div.spacer div[style]"
else: else:
return return
if not is_in_frame or needs_switch: if not is_in_frame or needs_switch:
@ -1000,7 +1016,10 @@ def uc_gui_handle_cf(driver, frame="iframe"):
pyautogui.press("\t") pyautogui.press("\t")
time.sleep(0.02) time.sleep(0.02)
active_element_css = js_utils.get_active_element_css(driver) active_element_css = js_utils.get_active_element_css(driver)
if active_element_css == "div.cf-turnstile-wrapper": if (
active_element_css == "div.cf-turnstile-wrapper"
or active_element_css.startswith("div#PYMIw2")
):
found_checkbox = True found_checkbox = True
break break
time.sleep(0.02) time.sleep(0.02)