@@ -184,6 +184,7 @@ def extend_driver(driver):
184184 driver .get_origin = DM .get_origin
185185 driver .get_user_agent = DM .get_user_agent
186186 driver .highlight = DM .highlight
187+ driver .highlight_click = DM .highlight_click
187188 driver .sleep = time .sleep
188189 driver .get_page_source = DM .get_page_source
189190 driver .get_title = DM .get_title
@@ -412,12 +413,14 @@ def uc_open_with_tab(driver, url):
412413 return None
413414
414415
415- def uc_open_with_reconnect (driver , url ):
416- """Open a url, then reconnect with UC before switching to the window."""
416+ def uc_open_with_reconnect (driver , url , reconnect_time = None ):
417+ """Open a url, disconnect chromedriver, wait, and reconnect."""
418+ if not reconnect_time :
419+ reconnect_time = constants .UC .RECONNECT_TIME
417420 if (url .startswith ("http:" ) or url .startswith ("https:" )):
418421 driver .execute_script ('window.open("%s","_blank");' % url )
419- driver .reconnect (2.65 )
420422 driver .close ()
423+ driver .reconnect (reconnect_time )
421424 driver .switch_to .window (driver .window_handles [- 1 ])
422425 else :
423426 driver .default_get (url ) # The original one
@@ -1314,9 +1317,9 @@ def get_driver(
13141317 binary_location = None
13151318 if (uc_cdp_events or uc_subprocess ) and not undetectable :
13161319 undetectable = True
1317- if is_using_uc ( undetectable , browser_name ) and mobile_emulator :
1318- if not user_agent :
1319- user_agent = constants .Mobile .AGENT
1320+ if mobile_emulator and not user_agent :
1321+ # Use a Pixel user agent by default if not specified
1322+ user_agent = constants .Mobile .AGENT
13201323 if page_load_strategy and page_load_strategy .lower () == "none" :
13211324 settings .PAGE_LOAD_STRATEGY = "none"
13221325 proxy_auth = False
@@ -3478,7 +3481,9 @@ def get_local_driver(
34783481 lambda url : uc_open_with_tab (driver , url )
34793482 )
34803483 driver .uc_open_with_reconnect = (
3481- lambda url : uc_open_with_reconnect (driver , url )
3484+ lambda * args , ** kwargs : uc_open_with_reconnect (
3485+ driver , * args , ** kwargs
3486+ )
34823487 )
34833488 if mobile_emulator :
34843489 uc_metrics = {}
0 commit comments