File tree 2 files changed +12
-2
lines changed
2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -711,6 +711,14 @@ def _set_chrome_options(
711
711
chromium_arg_item = "-" + chromium_arg_item
712
712
else :
713
713
chromium_arg_item = "--" + chromium_arg_item
714
+ if "remote-debugging-port=" in chromium_arg_item :
715
+ try :
716
+ # Extra processing for UC Mode
717
+ chrome_options ._remote_debugging_port = int (
718
+ chromium_arg_item .split ("remote-debugging-port=" )[1 ]
719
+ )
720
+ except Exception :
721
+ pass
714
722
if len (chromium_arg_item ) >= 3 :
715
723
chrome_options .add_argument (chromium_arg_item )
716
724
if devtools and not headless :
Original file line number Diff line number Diff line change @@ -134,13 +134,15 @@ def __init__(
134
134
options = ChromeOptions ()
135
135
try :
136
136
if hasattr (options , "_session" ) and options ._session is not None :
137
- # Prevent reuse of options
137
+ # Prevent reuse of options
138
138
raise RuntimeError ("you cannot reuse the ChromeOptions object" )
139
139
except AttributeError :
140
140
pass
141
141
options ._session = self
142
- debug_port = selenium .webdriver .common .service .utils .free_port ()
143
142
debug_host = "127.0.0.1"
143
+ debug_port = 9222
144
+ if hasattr (options , "_remote_debugging_port" ):
145
+ debug_port = options ._remote_debugging_port
144
146
if not options .debugger_address :
145
147
options .debugger_address = "%s:%d" % (debug_host , debug_port )
146
148
if enable_cdp_events :
You can’t perform that action at this time.
0 commit comments