@@ -404,7 +404,7 @@ def uc_special_open_if_cf(
404404 special = True
405405 if status_str == "403" or status_str == "429" :
406406 time .sleep (0.06 ) # Forbidden / Blocked! (Wait first!)
407- if special :
407+ if special and not hasattr ( driver , "cdp_base" ) :
408408 time .sleep (0.05 )
409409 with driver :
410410 driver .execute_script ('window.open("%s","_blank");' % url )
@@ -472,9 +472,12 @@ def uc_open_with_tab(driver, url):
472472 time .sleep (0.3 )
473473 return
474474 if (url .startswith ("http:" ) or url .startswith ("https:" )):
475- with driver :
476- driver .execute_script ('window.open("%s","_blank");' % url )
477- driver .close ()
475+ if not hasattr (driver , "cdp_base" ):
476+ with driver :
477+ driver .execute_script ('window.open("%s","_blank");' % url )
478+ driver .close ()
479+ else :
480+ driver .cdp .open (url )
478481 page_actions .switch_to_window (driver , driver .window_handles [- 1 ], 2 )
479482 else :
480483 driver .default_get (url ) # The original one
@@ -492,9 +495,12 @@ def uc_open_with_reconnect(driver, url, reconnect_time=None):
492495 reconnect_time = constants .UC .RECONNECT_TIME
493496 if (url .startswith ("http:" ) or url .startswith ("https:" )):
494497 script = 'window.open("%s","_blank");' % url
495- driver .execute_script (script )
496- time .sleep (0.05 )
497- driver .close ()
498+ if not hasattr (driver , "cdp_base" ):
499+ driver .execute_script (script )
500+ time .sleep (0.05 )
501+ driver .close ()
502+ else :
503+ driver .cdp .open (url )
498504 if reconnect_time == "disconnect" :
499505 driver .disconnect ()
500506 time .sleep (0.008 )
0 commit comments