From adcc564997fe02961fe499aad49badec31a79641 Mon Sep 17 00:00:00 2001 From: g1879 Date: Thu, 30 Nov 2023 14:54:49 +0800 Subject: [PATCH] =?UTF-8?q?3.2.35=E4=BF=AE=E5=A4=8D=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=88=E8=AF=A6=EF=BC=89=20=E6=8E=A5=E7=AE=A1=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=E5=99=A8=E6=97=A0=E9=A1=BB'--remote-allow-origins=3D*?= =?UTF-8?q?'=E5=8F=82=E6=95=B0=20tabs=E5=B1=9E=E6=80=A7=E5=BF=BD=E7=95=A5?= =?UTF-8?q?=E9=9A=90=E7=A7=81=E5=A3=B0=E6=98=8E=20=E4=BF=AE=E5=A4=8D=208x?= =?UTF-8?q?=20=E7=89=88=E6=B5=8F=E8=A7=88=E5=99=A8=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E4=B8=8B=E6=8B=89=E5=88=97=E8=A1=A8=E6=97=B6=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20=E4=BF=AE=E5=A4=8D=E6=9F=90=E4=BA=9B?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=E4=B8=8B=E6=8B=89=E6=A1=86=E4=B8=8D?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E8=81=94=E5=8A=A8=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=8D=9F=E5=9D=8F=E6=97=B6=E5=87=BA=E7=8E=B0=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20=E4=BF=AE=E5=A4=8Dget()=E6=96=B9=E6=B3=95url?= =?UTF-8?q?=E5=90=AB=E6=9F=90=E4=BA=9B=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E6=97=B6=E8=BF=9E=E6=8E=A5=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DrissionPage/chromium_driver.py | 3 ++- DrissionPage/commons/browser.py | 6 ------ DrissionPage/configs/configs.ini | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/DrissionPage/chromium_driver.py b/DrissionPage/chromium_driver.py index a9dca5d..f1a09a3 100644 --- a/DrissionPage/chromium_driver.py +++ b/DrissionPage/chromium_driver.py @@ -200,7 +200,8 @@ class ChromiumDriver(object): self._started = True self.status = self._STARTED_ self._stopped.clear() - self._ws = create_connection(self._websocket_url, enable_multithread=True) + self._ws = create_connection(self._websocket_url, enable_multithread=True, + suppress_origin=True) self._recv_th.start() self._handle_event_th.start() return True diff --git a/DrissionPage/commons/browser.py b/DrissionPage/commons/browser.py index 368adb9..9a7cbec 100644 --- a/DrissionPage/commons/browser.py +++ b/DrissionPage/commons/browser.py @@ -63,7 +63,6 @@ def get_launch_args(opt): # ----------处理arguments----------- result = set() has_user_path = False - remote_allow = False headless = False for i in opt.arguments: if i.startswith(('--load-extension=', '--remote-debugging-port=')): @@ -72,8 +71,6 @@ def get_launch_args(opt): result.add(f'--user-data-dir={Path(i[16:]).absolute()}') has_user_path = True continue - elif i.startswith('--remote-allow-origins='): - remote_allow = True elif i.startswith('--headless'): headless = True @@ -85,9 +82,6 @@ def get_launch_args(opt): path.mkdir(parents=True, exist_ok=True) result.add(f'--user-data-dir={path}') - if not remote_allow: - result.add('--remote-allow-origins=*') - if not headless and system().lower() == 'linux': from os import popen r = popen('systemctl list-units | grep graphical.target') diff --git a/DrissionPage/configs/configs.ini b/DrissionPage/configs/configs.ini index 9a5ad35..ab4c0a1 100644 --- a/DrissionPage/configs/configs.ini +++ b/DrissionPage/configs/configs.ini @@ -4,7 +4,7 @@ download_path = [chrome_options] debugger_address = 127.0.0.1:9222 binary_location = chrome -arguments = ['--remote-allow-origins=*', '--no-first-run', '--disable-gpu', '--disable-infobars', '--disable-popup-blocking'] +arguments = ['--no-first-run', '--disable-gpu', '--disable-infobars', '--disable-popup-blocking'] extensions = [] experimental_options = {'prefs': {'profile.default_content_settings.popups': 0, 'profile.default_content_setting_values': {'notifications': 2}}} page_load_strategy = normal