diff --git a/DrissionPage/_base/browser.py b/DrissionPage/_base/browser.py index 2171bd1..6556480 100644 --- a/DrissionPage/_base/browser.py +++ b/DrissionPage/_base/browser.py @@ -123,7 +123,7 @@ class Browser(object): :param url: 要匹配url的文本 :param tab_type: tab类型,可用列表输入多个 :param single: 是否返回首个结果的id,为False返回所有信息 - :return: tab id或tab dict + :return: tab id或tab列表 """ tabs = self._driver.get(f'http://{self.address}/json').json() # 不要改用cdp diff --git a/DrissionPage/_pages/chromium_base.py b/DrissionPage/_pages/chromium_base.py index 025ab24..0d51807 100644 --- a/DrissionPage/_pages/chromium_base.py +++ b/DrissionPage/_pages/chromium_base.py @@ -5,6 +5,7 @@ """ from json import loads, JSONDecodeError from os.path import sep +from pathlib import Path from re import findall, match from threading import Thread from time import perf_counter, sleep @@ -16,7 +17,7 @@ from .._elements.none_element import NoneElement from .._elements.session_element import make_session_ele from .._functions.locator import get_loc, is_loc from .._functions.settings import Settings -from .._functions.tools import get_usable_path, raise_error +from .._functions.tools import raise_error from .._functions.web import location_in_viewport from .._units.actions import Actions from .._units.listener import Listener @@ -1021,7 +1022,7 @@ class ChromiumBase(BasePage): name = f'{name}.jpg' path = f'{path}{sep}{name}' - path = get_usable_path(path) + path = Path(path) pic_type = path.suffix.lower() pic_type = 'jpeg' if pic_type == '.jpg' else pic_type[1:] diff --git a/DrissionPage/_pages/chromium_page.py b/DrissionPage/_pages/chromium_page.py index 73777de..e01419a 100644 --- a/DrissionPage/_pages/chromium_page.py +++ b/DrissionPage/_pages/chromium_page.py @@ -162,7 +162,7 @@ class ChromiumPage(ChromiumBase): :param url: 要匹配url的文本 :param tab_type: tab类型,可用列表输入多个 :param single: 是否返回首个结果的id,为False返回所有信息 - :return: tab id或tab dict + :return: tab id或tab列表 """ return self._browser.find_tabs(title, url, tab_type, single) diff --git a/DrissionPage/_units/screencast.py b/DrissionPage/_units/screencast.py index 4b927a8..086e14c 100644 --- a/DrissionPage/_units/screencast.py +++ b/DrissionPage/_units/screencast.py @@ -33,7 +33,9 @@ class Screencast(object): self.set_save_path(save_path) if self._path is None: raise ValueError('save_path必须设置。') - clean_folder(self._path) + tmp = self._path / 'tmp' + tmp.mkdir(parents=True, exist_ok=True) + clean_folder(tmp) if self._mode.startswith('frugal'): self._page.driver.set_callback('Page.screencastFrame', self._onScreencastFrame) self._page.run_cdp('Page.startScreencast', everyNthFrame=1, quality=100)