@@ -340,17 +340,19 @@ def find_edgedriver_version_to_use(use_version, driver_version):
340
340
return use_version
341
341
342
342
343
- def has_cf (text ):
343
+ def has_captcha (text ):
344
344
if (
345
345
"<title>403 Forbidden</title>" in text
346
346
or "Permission Denied</title>" in text
347
347
or 'id="challenge-error-text"' in text
348
348
or "<title>Just a moment..." in text
349
349
or 'action="/?__cf_chl_f_tk' in text
350
+ or 'id="challenge-widget-' in text
350
351
or 'src="chromedriver.js"' in text
351
352
or 'class="g-recaptcha"' in text
352
353
or 'content="Pixelscan"' in text
353
354
or 'id="challenge-form"' in text
355
+ or "/challenge-platform" in text
354
356
or "window._cf_chl_opt" in text
355
357
or "/recaptcha/api.js" in text
356
358
or "/turnstile/" in text
@@ -377,7 +379,7 @@ def uc_special_open_if_cf(
377
379
status_str .startswith ("3" )
378
380
or status_str .startswith ("4" )
379
381
or status_str .startswith ("5" )
380
- or has_cf (req_get .text )
382
+ or has_captcha (req_get .text )
381
383
):
382
384
special = True
383
385
if status_str == "403" or status_str == "429" :
@@ -763,6 +765,8 @@ def _on_a_cf_turnstile_page(driver):
763
765
source = driver .get_page_source ()
764
766
if (
765
767
'data-callback="onCaptchaSuccess"' in source
768
+ or "/challenge-platform/scripts/" in source
769
+ or 'id="challenge-widget-' in source
766
770
or "cf-turnstile-" in source
767
771
):
768
772
return True
@@ -866,6 +870,13 @@ def _uc_gui_click_captcha(
866
870
and driver .is_element_present ("div.spacer div" )
867
871
):
868
872
frame = "div.spacer div"
873
+ elif (
874
+ driver .is_element_present ('script[src*="challenges.c"]' )
875
+ and driver .is_element_present (
876
+ '[data-testid*="challenge-"] div'
877
+ )
878
+ ):
879
+ frame = '[data-testid*="challenge-"] div'
869
880
elif (
870
881
(
871
882
driver .is_element_present ('[name*="cf-turnstile-"]' )
@@ -883,6 +894,14 @@ def _uc_gui_click_captcha(
883
894
)
884
895
):
885
896
frame = "%s .cf-turnstile-wrapper" % frame
897
+ elif (
898
+ frame != "iframe"
899
+ and driver .is_element_present (
900
+ '%s [name*="cf-turnstile"]' % frame
901
+ )
902
+ and driver .is_element_present ("%s div" % frame )
903
+ ):
904
+ frame = "%s div" % frame
886
905
elif driver .is_element_present (".cf-turnstile-wrapper" ):
887
906
frame = ".cf-turnstile-wrapper"
888
907
elif driver .is_element_present (
@@ -1102,6 +1121,13 @@ def _uc_gui_handle_captcha(
1102
1121
and driver .is_element_present ("div.spacer div" )
1103
1122
):
1104
1123
frame = "div.spacer div"
1124
+ elif (
1125
+ driver .is_element_present ('script[src*="challenges.c"]' )
1126
+ and driver .is_element_present (
1127
+ '[data-testid*="challenge-"] div'
1128
+ )
1129
+ ):
1130
+ frame = '[data-testid*="challenge-"] div'
1105
1131
elif (
1106
1132
(
1107
1133
driver .is_element_present ('[name*="cf-turnstile-"]' )
0 commit comments