From 5f429840f85b501b7296b09d1365882c255caf78 Mon Sep 17 00:00:00 2001 From: g1879 Date: Tue, 22 Aug 2023 09:15:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dset.timeouts()=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=9B=E5=B1=8F=E8=94=BDLinux=E5=92=8CMAC=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E4=B8=AD=E8=BF=90=E8=A1=8C=E6=97=B6=E9=82=A3=E4=BA=9B?= =?UTF-8?q?=E5=95=B0=E5=97=A6=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DrissionPage/commons/browser.py | 4 ++-- DrissionPage/setter.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DrissionPage/commons/browser.py b/DrissionPage/commons/browser.py index 86b3e9e..339091f 100644 --- a/DrissionPage/commons/browser.py +++ b/DrissionPage/commons/browser.py @@ -5,7 +5,7 @@ """ from json import load, dump from pathlib import Path -from subprocess import Popen +from subprocess import Popen, DEVNULL from tempfile import gettempdir from time import perf_counter, sleep @@ -173,7 +173,7 @@ def _run_browser(port, path: str, args) -> Popen: arguments = [p, f'--remote-debugging-port={port}'] arguments.extend(args) try: - return Popen(arguments, shell=False) + return Popen(arguments, shell=False, stdout=DEVNULL, stderr=DEVNULL) except FileNotFoundError: raise FileNotFoundError('未找到浏览器,请手动指定浏览器可执行文件路径。') diff --git a/DrissionPage/setter.py b/DrissionPage/setter.py index a49bbfd..8cce32c 100644 --- a/DrissionPage/setter.py +++ b/DrissionPage/setter.py @@ -42,7 +42,7 @@ class ChromiumBaseSetter(object): """ if implicit is not None: self._page.timeouts.implicit = implicit - self._page.timeout = implicit + self._page._timeout = implicit if page_load is not None: self._page.timeouts.page_load = page_load