修复set.timeouts()问题;屏蔽Linux和MAC系统中运行时那些啰嗦的提示

This commit is contained in:
g1879 2023-08-22 09:15:26 +08:00
parent dbabe35489
commit 5f429840f8
2 changed files with 3 additions and 3 deletions

View File

@ -5,7 +5,7 @@
""" """
from json import load, dump from json import load, dump
from pathlib import Path from pathlib import Path
from subprocess import Popen from subprocess import Popen, DEVNULL
from tempfile import gettempdir from tempfile import gettempdir
from time import perf_counter, sleep 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 = [p, f'--remote-debugging-port={port}']
arguments.extend(args) arguments.extend(args)
try: try:
return Popen(arguments, shell=False) return Popen(arguments, shell=False, stdout=DEVNULL, stderr=DEVNULL)
except FileNotFoundError: except FileNotFoundError:
raise FileNotFoundError('未找到浏览器,请手动指定浏览器可执行文件路径。') raise FileNotFoundError('未找到浏览器,请手动指定浏览器可执行文件路径。')

View File

@ -42,7 +42,7 @@ class ChromiumBaseSetter(object):
""" """
if implicit is not None: if implicit is not None:
self._page.timeouts.implicit = implicit self._page.timeouts.implicit = implicit
self._page.timeout = implicit self._page._timeout = implicit
if page_load is not None: if page_load is not None:
self._page.timeouts.page_load = page_load self._page.timeouts.page_load = page_load