-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
@blondski
Description
Hi @mdmintz ! Is seleniumbase capable of handling this cloudflare managed challange in UC mode?
<div class="container-content">
<div class="container-header">
<p class="hide-later" style="height: 400px; display: none;"> </p>
<p class="display-later" style="display: block;">Your browser was tested against security. Please check following result:</p>
<p class="display-later" style="display: block;"></p><div class="main-wrapper" role="main"><div class="main-content"><p id="FGRYW5"></p><div id="LsMgo8" style="display: grid;"><div><div><input type="hidden" name="cf-turnstile-response" id="cf-chl-widget-r0zka_response"></div></div></div><div id="jHZB4" class="spacer loading-verifying" style="display: none; visibility: hidden;"><div class="lds-ring"><div></div><div></div><div></div><div></div></div></div><div id="gGeN3"></div><div id="OiwZ5" style="display: none;"><div class="core-msg spacer">Waiting for x to respond...</div></div><noscript><div class="h2"><span id="challenge-error-text">Enable JavaScript and cookies to continue</span></div></noscript></div></div><script>(function(){window._cf_chl_opt = {cvId: '3',cZone: 'www.x.com',cType: 'managed',cRay: '977c2060df4d901f',cH: 'ov433_ZCEAmIMyWb7.ZfidN9CEhkrE_AS2x2Fc1cjQw-1756639099-1.2.1.1-6lbWdX3.3RGV3czj3iDKmvf_fTAUKIN2HEWoTG3CpICyN5VAQySQJLy53djtacwD',cUPMDTk:"\/solutions\/auth\/?__cf_chl_tk=z...s",cFPWv: 'b',cITimeS: '1756639099',cTplC:1,cTplV:5,cTplB: 'cf',fa:"\/solutions\/auth\/?__cf_chl_f_tk=....,};var a = document.createElement('script');a.src = '/cdn-cgi/challenge-platform/h/b/orchestrate/chl_page/v1?ray=977c2060df4d901f';window._cf_chl_opt.cOgUHash = location.hash === '' && location.href.indexOf('#') !== -1 ? '#' : location.hash;window._cf_chl_opt.cOgUQuery = location.search === '' && location.href.slice(0, location.href.length - window._cf_chl_opt.cOgUHash.length).indexOf('?') !== -1 ? '?' : location.search;if (window.history && window.history.replaceState) {var ogU = location.pathname + window._cf_chl_opt.cOgUQuery + window._cf_chl_opt.cOgUHash;history.replaceState(null, null,"\/solutions\/auth\/?__cf_chl_rt_tk=zHAGOOPCyky4ly7D54EJhx8JRzRPLkYyFI91JFaJEwg-1756639099-1.0.1.1-Kcy0W7OEdmSJXMdr4foTqYF.kWOUac1HExbWbx1HnQs"+ window._cf_chl_opt.cOgUHash);a.onload = function() {history.replaceState(null, null, ogU);}}document.getElementsByTagName('head')[0].appendChild(a);}());</script><p></p>
<p class="display-later" style="display: block; padding: 10px; background-color: rgb(240, 242, 245); font-size: 12px;">Technical Details: x, Managed Challenge , IP: ... , RayID: 977c2060df4d901f</p>
<div class="display-later" style="display: block;">
<h4 class="hal-h4" style="padding-top:20px;">Why did this happen?</h4>
<p>This website is using a security service to protect itself from online attacks. The page or application that you want to use, triggered the security solution. </p>
<h4 class="hal-h4" style="padding-top:20px;">How can I proceed?</h4>
<p>Please follow the instructions from above. In case you see a Captcha displayed, please continue solving it. In case of issues, maybe try another browser or clearing caches related to our website.</p>
</div>
I tried to handle it but it seems to fail in uc mode (xvfb headful, --single-process & disable-gpu chromium args) and sb-args:
base = dict(
uc=True,
incognito=True,
pls="eager",
locale_code="en-US",
test=False,
log_cdp= True,
user_data_dir=str(USER_DATA),
proxy="127.0.0.1:8118",
xvfb=True,
xvfb_metrics="1920,1080",
)
the used method:
def handle_cf(sb, mode="uc") -> bool:
try:
if mode == "uc":
sb.uc_gui_click_cf(frame=parent_sel, retry=True, blind=False)
# let the page settle & reconnect
sb.wait_for_ready_state_complete()
sb.sleep(2.0)
return not on_cf_page(sb)
except Exception:
pass