@@ -443,14 +443,14 @@ def has_captcha(text):
443443 "<title>403 Forbidden</title>" in text
444444 or "Permission Denied</title>" in text
445445 or 'id="challenge-error-text"' in text
446+ or "/challenge-platform/h/b/" in text
446447 or "<title>Just a moment..." in text
447448 or 'action="/?__cf_chl_f_tk' in text
448449 or 'id="challenge-widget-' in text
449450 or 'src="chromedriver.js"' in text
450451 or 'class="g-recaptcha"' in text
451452 or 'content="Pixelscan"' in text
452453 or 'id="challenge-form"' in text
453- or "/challenge-platform" in text
454454 or "window._cf_chl_opt" in text
455455 or "/recaptcha/api.js" in text
456456 or "/turnstile/" in text
@@ -656,10 +656,8 @@ def uc_open_with_cdp_mode(driver, url=None, **kwargs):
656656 safe_url = False
657657
658658 if (
659- hasattr (driver , "_is_using_cdp" )
660- and driver ._is_using_cdp
661- and hasattr (driver , "cdp" )
662- and driver .cdp
659+ getattr (driver , "_is_using_cdp" , None )
660+ and getattr (driver , "cdp" , None )
663661 and hasattr (driver .cdp , "loop" )
664662 ):
665663 # CDP Mode was already initialized
@@ -1042,7 +1040,7 @@ def uc_click(
10421040def verify_pyautogui_has_a_headed_browser (driver ):
10431041 """PyAutoGUI requires a headed browser so that it can
10441042 focus on the correct element when performing actions."""
1045- if hasattr (driver , "_is_hidden" ) and driver . _is_hidden :
1043+ if getattr (driver , "_is_hidden" , None ) :
10461044 raise Exception (
10471045 "PyAutoGUI can't be used in headless mode!"
10481046 )
@@ -1142,8 +1140,7 @@ def get_configured_pyautogui(pyautogui_copy):
11421140 and "DISPLAY" in os .environ .keys ()
11431141 ):
11441142 if (
1145- hasattr (sb_config , "_pyautogui_x11_display" )
1146- and sb_config ._pyautogui_x11_display
1143+ getattr (sb_config , "_pyautogui_x11_display" , None )
11471144 and hasattr (pyautogui_copy ._pyautogui_x11 , "_display" )
11481145 and (
11491146 sb_config ._pyautogui_x11_display
@@ -1300,8 +1297,12 @@ def uc_gui_click_x_y(driver, x, y, timeframe=0.25):
13001297def _on_a_cf_turnstile_page (driver ):
13011298 source = driver .get_page_source ()
13021299 if (
1303- 'data-callback="onCaptchaSuccess"' in source
1304- or "/challenge-platform/scripts/" in source
1300+ (
1301+ 'data-callback="onCaptchaSuccess"' in source
1302+ and 'title="reCAPTCHA"' not in source
1303+ and 'id="recaptcha-token"' not in source
1304+ )
1305+ or "/challenge-platform/h/b/" in source
13051306 or 'id="challenge-widget-' in source
13061307 or "challenges.cloudf" in source
13071308 or "cf-turnstile-" in source
0 commit comments