diff --git a/DrissionPage/configs/chromium_options.py b/DrissionPage/configs/chromium_options.py index 0c06d93..4d42d3b 100644 --- a/DrissionPage/configs/chromium_options.py +++ b/DrissionPage/configs/chromium_options.py @@ -54,7 +54,7 @@ class ChromiumOptions(object): if self._auto_port: port, path = PortFinder().get_port() self._debugger_address = f'127.0.0.1:{port}' - self.set_paths(user_data_path=path) + self.set_argument('--user-data-dir', path) return self.ini_path = None @@ -299,9 +299,11 @@ class ChromiumOptions(object): """ if browser_path is not None: self._binary_location = str(browser_path) + self._auto_port = False if local_port is not None: self._debugger_address = f'127.0.0.1:{local_port}' + self._auto_port = False if debugger_address is not None: self._debugger_address = debugger_address @@ -313,6 +315,7 @@ class ChromiumOptions(object): u = str(user_data_path) self.set_argument('--user-data-dir', u) self._user_data_path = u + self._auto_port = False if cache_path is not None: self.set_argument('--disk-cache-dir', str(cache_path)) @@ -330,7 +333,6 @@ class ChromiumOptions(object): self._auto_port = True else: self._auto_port = False - self._debugger_address = '127.0.0.1:9222' return self def save(self, path=None): diff --git a/DrissionPage/configs/configs.ini b/DrissionPage/configs/configs.ini index dd02ce2..bc9afba 100644 --- a/DrissionPage/configs/configs.ini +++ b/DrissionPage/configs/configs.ini @@ -10,7 +10,7 @@ extensions = [] experimental_options = {'prefs': {'profile.default_content_settings.popups': 0, 'profile.default_content_setting_values': {'notifications': 2}, 'plugins.plugins_list': [{'enabled': False, 'name': 'Chrome PDF Viewer'}]}, 'useAutomationExtension': False, 'excludeSwitches': ['enable-automation']} page_load_strategy = normal user = Default -auto_port = True +auto_port = False [session_options] headers = {'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8', 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'connection': 'keep-alive', 'accept-charset': 'GB2312,utf-8;q=0.7,*;q=0.7'}