@@ -220,6 +220,7 @@ def extend_driver(driver):
220
220
driver .highlight_if_visible = DM .highlight_if_visible
221
221
driver .sleep = time .sleep
222
222
driver .get_attribute = DM .get_attribute
223
+ driver .get_parent = DM .get_parent
223
224
driver .get_current_url = DM .get_current_url
224
225
driver .get_page_source = DM .get_page_source
225
226
driver .get_title = DM .get_title
@@ -647,6 +648,7 @@ def uc_open_with_cdp_mode(driver, url=None):
647
648
cdp .click_if_visible = CDPM .click_if_visible
648
649
cdp .click_visible_elements = CDPM .click_visible_elements
649
650
cdp .mouse_click = CDPM .mouse_click
651
+ cdp .get_parent = CDPM .get_parent
650
652
cdp .remove_element = CDPM .remove_element
651
653
cdp .remove_from_dom = CDPM .remove_from_dom
652
654
cdp .remove_elements = CDPM .remove_elements
@@ -5394,6 +5396,19 @@ def get_local_driver(
5394
5396
)
5395
5397
driver ._is_hidden = (headless or headless2 )
5396
5398
driver ._is_using_uc = True
5399
+ with suppress (Exception ):
5400
+ if int (uc_driver_version ) >= 133 :
5401
+ for window_handle in driver .window_handles :
5402
+ driver .switch_to .window (window_handle )
5403
+ if driver .current_url .startswith (
5404
+ "chrome-extension://"
5405
+ ):
5406
+ driver .close ()
5407
+ time .sleep (0.003 )
5408
+ driver .switch_to .window (driver .window_handles [0 ])
5409
+ time .sleep (0.003 )
5410
+ driver .connect ()
5411
+ time .sleep (0.003 )
5397
5412
if mobile_emulator :
5398
5413
uc_metrics = {}
5399
5414
if (
0 commit comments