From 1c63a0e36c2f4cecac87d6e8c709146e6d46c76f Mon Sep 17 00:00:00 2001 From: g1879 Date: Fri, 23 Aug 2024 00:04:02 +0800 Subject: [PATCH] =?UTF-8?q?tabs=E6=8B=86=E5=88=86=E6=88=90=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E6=96=87=E4=BB=B6=EF=BC=9Bbrowser=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=94=B9=E5=90=8D=E4=B8=BAchromium?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DrissionPage/__init__.py | 5 +- DrissionPage/__init__.pyi | 5 +- .../_base/{browser.py => chromium.py} | 3 +- .../_base/{browser.pyi => chromium.pyi} | 3 +- DrissionPage/_elements/chromium_element.pyi | 2 +- DrissionPage/_functions/cookies.pyi | 2 +- DrissionPage/_functions/web.pyi | 2 +- DrissionPage/_pages/chromium_base.pyi | 5 +- DrissionPage/_pages/chromium_frame.pyi | 3 +- DrissionPage/_pages/chromium_page.py | 2 +- DrissionPage/_pages/chromium_page.pyi | 4 +- DrissionPage/_pages/chromium_tab.py | 70 ++++++++++++ DrissionPage/_pages/chromium_tab.pyi | 108 ++++++++++++++++++ DrissionPage/_pages/mix_page.pyi | 2 +- DrissionPage/_pages/{tabs.py => mix_tab.py} | 64 +---------- DrissionPage/_pages/{tabs.pyi => mix_tab.pyi} | 102 +---------------- DrissionPage/_units/actions.pyi | 2 +- DrissionPage/_units/clicker.pyi | 3 +- DrissionPage/_units/cookies_setter.pyi | 6 +- DrissionPage/_units/downloader.pyi | 2 +- DrissionPage/_units/rect.pyi | 4 +- DrissionPage/_units/scroller.pyi | 3 +- DrissionPage/_units/setter.pyi | 7 +- DrissionPage/_units/states.pyi | 2 +- DrissionPage/_units/waiter.pyi | 5 +- DrissionPage/common.py | 2 +- DrissionPage/items.py | 5 +- docs/index.html | 34 ------ 28 files changed, 227 insertions(+), 230 deletions(-) rename DrissionPage/_base/{browser.py => chromium.py} (99%) rename DrissionPage/_base/{browser.pyi => chromium.pyi} (99%) create mode 100644 DrissionPage/_pages/chromium_tab.py create mode 100644 DrissionPage/_pages/chromium_tab.pyi rename DrissionPage/_pages/{tabs.py => mix_tab.py} (79%) rename DrissionPage/_pages/{tabs.pyi => mix_tab.pyi} (73%) delete mode 100644 docs/index.html diff --git a/DrissionPage/__init__.py b/DrissionPage/__init__.py index ca587ef..0256fb7 100644 --- a/DrissionPage/__init__.py +++ b/DrissionPage/__init__.py @@ -5,13 +5,12 @@ @Copyright: (c) 2024 by g1879, Inc. All Rights Reserved. @License : BSD 3-Clause. """ -from ._base.browser import Chromium +from ._base.chromium import Chromium from ._configs.chromium_options import ChromiumOptions from ._configs.session_options import SessionOptions -from ._pages.session_page import SessionPage - from ._pages.chromium_page import ChromiumPage from ._pages.mix_page import MixPage from ._pages.mix_page import MixPage as WebPage +from ._pages.session_page import SessionPage __version__ = '4.1.0.0b20' diff --git a/DrissionPage/__init__.pyi b/DrissionPage/__init__.pyi index 5fc228d..79facd7 100644 --- a/DrissionPage/__init__.pyi +++ b/DrissionPage/__init__.pyi @@ -5,14 +5,13 @@ @Copyright: (c) 2024 by g1879, Inc. All Rights Reserved. @License : BSD 3-Clause. """ -from ._base.browser import Chromium +from ._base.chromium import Chromium from ._configs.chromium_options import ChromiumOptions from ._configs.session_options import SessionOptions -from ._pages.session_page import SessionPage - from ._pages.chromium_page import ChromiumPage from ._pages.mix_page import MixPage from ._pages.mix_page import MixPage as WebPage +from ._pages.session_page import SessionPage __all__ = ['MixPage', 'WebPage', 'ChromiumPage', 'Chromium', 'ChromiumOptions', 'SessionOptions', 'SessionPage', '__version__'] __version__: str = ... diff --git a/DrissionPage/_base/browser.py b/DrissionPage/_base/chromium.py similarity index 99% rename from DrissionPage/_base/browser.py rename to DrissionPage/_base/chromium.py index 7368362..5d7c735 100644 --- a/DrissionPage/_base/browser.py +++ b/DrissionPage/_base/chromium.py @@ -21,7 +21,8 @@ from .._functions.settings import Settings from .._functions.tools import PortFinder from .._functions.tools import raise_error from .._pages.chromium_base import Timeout -from .._pages.tabs import ChromiumTab, MixTab +from .._pages.chromium_tab import ChromiumTab +from .._pages.mix_tab import MixTab from .._units.downloader import DownloadManager from .._units.setter import BrowserSetter from .._units.states import BrowserStates diff --git a/DrissionPage/_base/browser.pyi b/DrissionPage/_base/chromium.pyi similarity index 99% rename from DrissionPage/_base/browser.pyi rename to DrissionPage/_base/chromium.pyi index 683a491..a2745de 100644 --- a/DrissionPage/_base/browser.pyi +++ b/DrissionPage/_base/chromium.pyi @@ -13,7 +13,8 @@ from .._configs.chromium_options import ChromiumOptions from .._configs.session_options import SessionOptions from .._functions.cookies import CookiesList from .._pages.chromium_base import Timeout -from .._pages.tabs import ChromiumTab, MixTab +from .._pages.chromium_tab import ChromiumTab +from .._pages.mix_tab import MixTab from .._units.downloader import DownloadManager from .._units.setter import BrowserSetter from .._units.states import BrowserStates diff --git a/DrissionPage/_elements/chromium_element.pyi b/DrissionPage/_elements/chromium_element.pyi index f1b4290..6b44613 100644 --- a/DrissionPage/_elements/chromium_element.pyi +++ b/DrissionPage/_elements/chromium_element.pyi @@ -14,7 +14,7 @@ from .._functions.elements import SessionElementsList, ChromiumElementsList from .._pages.chromium_base import ChromiumBase from .._pages.chromium_frame import ChromiumFrame from .._pages.chromium_page import ChromiumPage -from .._pages.tabs import ChromiumTab +from .._pages.chromium_tab import ChromiumTab from .._pages.mix_page import MixPage from .._units.clicker import Clicker from .._units.rect import ElementRect diff --git a/DrissionPage/_functions/cookies.pyi b/DrissionPage/_functions/cookies.pyi index 714620d..999c355 100644 --- a/DrissionPage/_functions/cookies.pyi +++ b/DrissionPage/_functions/cookies.pyi @@ -11,7 +11,7 @@ from typing import Union from requests import Session from requests.cookies import RequestsCookieJar -from .._base.browser import Chromium +from .._base.chromium import Chromium from .._pages.chromium_base import ChromiumBase diff --git a/DrissionPage/_functions/web.pyi b/DrissionPage/_functions/web.pyi index 25467fd..55010c6 100644 --- a/DrissionPage/_functions/web.pyi +++ b/DrissionPage/_functions/web.pyi @@ -12,7 +12,7 @@ from .._base.base import DrissionElement, BaseParser from .._elements.chromium_element import ChromiumElement from .._pages.chromium_base import ChromiumBase from .._pages.chromium_page import ChromiumPage -from .._pages.tabs import ChromiumTab +from .._pages.chromium_tab import ChromiumTab def get_ele_txt(e: DrissionElement) -> str: diff --git a/DrissionPage/_pages/chromium_base.pyi b/DrissionPage/_pages/chromium_base.pyi index f2c552a..94d75d1 100644 --- a/DrissionPage/_pages/chromium_base.pyi +++ b/DrissionPage/_pages/chromium_base.pyi @@ -9,10 +9,11 @@ from pathlib import Path from typing import Union, Tuple, List, Any, Optional, Literal from .chromium_page import ChromiumPage +from .chromium_tab import ChromiumTab from .mix_page import MixPage -from .tabs import ChromiumTab, MixTab +from .mix_tab import MixTab from .._base.base import BasePage -from .._base.browser import Chromium +from .._base.chromium import Chromium from .._base.driver import Driver from .._elements.chromium_element import ChromiumElement from .._elements.session_element import SessionElement diff --git a/DrissionPage/_pages/chromium_frame.pyi b/DrissionPage/_pages/chromium_frame.pyi index bbb7c93..6fab3ae 100644 --- a/DrissionPage/_pages/chromium_frame.pyi +++ b/DrissionPage/_pages/chromium_frame.pyi @@ -9,7 +9,8 @@ from pathlib import Path from typing import Union, Tuple, List, Any, Optional, Literal from .chromium_base import ChromiumBase -from .tabs import ChromiumTab, MixTab +from .chromium_tab import ChromiumTab +from .mix_tab import MixTab from .._elements.chromium_element import ChromiumElement, ShadowRoot from .._functions.elements import ChromiumElementsList from .._units.listener import FrameListener diff --git a/DrissionPage/_pages/chromium_page.py b/DrissionPage/_pages/chromium_page.py index 1d251c4..5b005b0 100644 --- a/DrissionPage/_pages/chromium_page.py +++ b/DrissionPage/_pages/chromium_page.py @@ -7,7 +7,7 @@ """ from time import sleep -from .._base.browser import Chromium +from .._base.chromium import Chromium from .._functions.web import save_page from .._pages.chromium_base import ChromiumBase from .._units.setter import ChromiumPageSetter diff --git a/DrissionPage/_pages/chromium_page.pyi b/DrissionPage/_pages/chromium_page.pyi index 5ef3e66..f5a1562 100644 --- a/DrissionPage/_pages/chromium_page.pyi +++ b/DrissionPage/_pages/chromium_page.pyi @@ -8,10 +8,10 @@ from pathlib import Path from typing import Union, Tuple, List, Optional -from .._base.browser import Chromium +from .._base.chromium import Chromium from .._configs.chromium_options import ChromiumOptions from .._pages.chromium_base import ChromiumBase -from .._pages.tabs import ChromiumTab +from .._pages.chromium_tab import ChromiumTab from .._units.rect import TabRect from .._units.setter import ChromiumPageSetter from .._units.waiter import ChromiumPageWaiter diff --git a/DrissionPage/_pages/chromium_tab.py b/DrissionPage/_pages/chromium_tab.py new file mode 100644 index 0000000..49195a8 --- /dev/null +++ b/DrissionPage/_pages/chromium_tab.py @@ -0,0 +1,70 @@ +# -*- coding:utf-8 -*- +""" +@Author : g1879 +@Contact : g1879@qq.com +@Copyright: (c) 2024 by g1879, Inc. All Rights Reserved. +@License : BSD 3-Clause. +""" +from copy import copy +from time import sleep + +from .._functions.settings import Settings +from .._functions.web import save_page +from .._pages.chromium_base import ChromiumBase +from .._units.setter import TabSetter +from .._units.waiter import TabWaiter + + +class ChromiumTab(ChromiumBase): + _TABS = {} + + def __new__(cls, browser, tab_id): + if Settings.singleton_tab_obj and tab_id in cls._TABS: + r = cls._TABS[tab_id] + while not hasattr(r, '_frame_id'): + sleep(.1) + return r + r = object.__new__(cls) + cls._TABS[tab_id] = r + return r + + def __init__(self, browser, tab_id): + if Settings.singleton_tab_obj and hasattr(self, '_created'): + return + self._created = True + + super().__init__(browser, tab_id) + self._tab = self + self._type = 'ChromiumTab' + + def _d_set_runtime_settings(self): + self._timeouts = copy(self.browser.timeouts) + self.retry_times = self.browser.retry_times + self.retry_interval = self.browser.retry_interval + self._load_mode = self.browser._load_mode + self._download_path = self.browser.download_path + self._auto_handle_alert = self.browser._auto_handle_alert + + def close(self, others=False): + self.browser.close_tabs(self.tab_id, others=others) + + @property + def set(self): + if self._set is None: + self._set = TabSetter(self) + return self._set + + @property + def wait(self): + if self._wait is None: + self._wait = TabWaiter(self) + return self._wait + + def save(self, path=None, name=None, as_pdf=False, **kwargs): + return save_page(self, path, name, as_pdf, kwargs) + + def __repr__(self): + return f'' + + def _on_disconnect(self): + ChromiumTab._TABS.pop(self.tab_id, None) diff --git a/DrissionPage/_pages/chromium_tab.pyi b/DrissionPage/_pages/chromium_tab.pyi new file mode 100644 index 0000000..0185d61 --- /dev/null +++ b/DrissionPage/_pages/chromium_tab.pyi @@ -0,0 +1,108 @@ +# -*- coding:utf-8 -*- +""" +@Author : g1879 +@Contact : g1879@qq.com +@Copyright: (c) 2024 by g1879, Inc. All Rights Reserved. +@License : BSD 3-Clause. +""" +from pathlib import Path +from typing import Union, Optional + +from .chromium_base import ChromiumBase +from .._base.chromium import Chromium +from .._units.rect import TabRect +from .._units.setter import TabSetter +from .._units.waiter import TabWaiter + + +class ChromiumTab(ChromiumBase): + """实现浏览器标签页的类""" + _TABS: dict = ... + _tab: ChromiumTab = ... + _rect: Optional[TabRect] = ... + + def __new__(cls, browser: Chromium, tab_id: str): + """ + :param browser: Browser对象 + :param tab_id: 标签页id + """ + ... + + def __init__(self, browser: Chromium, tab_id: str): + """ + :param browser: Browser对象 + :param tab_id: 标签页id + """ + ... + + def _d_set_runtime_settings(self) -> None: + """重写设置浏览器运行参数方法""" + ... + + def close(self, others: bool = False) -> None: + """关闭标签页 + :param others: 是否关闭其它,保留自己 + :return: None + """ + ... + + @property + def set(self) -> TabSetter: + """返回用于设置的对象""" + ... + + @property + def wait(self) -> TabWaiter: + """返回用于等待的对象""" + ... + + def save(self, + path: Union[str, Path] = None, + name: str = None, + as_pdf: bool = False, + landscape: bool = False, + displayHeaderFooter: bool = False, + printBackground: bool = False, + scale: float = 1, + paperWidth: float = 8.5, + paperHeight: float = 11, + marginTop: float = 11, + marginBottom: float = 1, + marginLeft: float = 1, + marginRight: float = 1, + pageRanges: str = '', + headerTemplate: str = '', + footerTemplate: str = '', + preferCSSPageSize: bool = False, + generateTaggedPDF: bool = ..., + generateDocumentOutline: bool = ...) -> Union[bytes, str]: + """把当前页面保存为文件,如果path和name参数都为None,只返回文本 + :param path: 保存路径,为None且name不为None时保存在当前路径 + :param name: 文件名,为None且path不为None时用title属性值 + :param as_pdf: 为Ture保存为pdf,否则为mhtml且忽略kwargs参数 + :param landscape: 纸张方向,as_pdf为True时才生效 + :param displayHeaderFooter: 是否显示页头页脚,as_pdf为True时才生效 + :param printBackground: 是否打印背景图片,as_pdf为True时才生效 + :param scale: 缩放比例,as_pdf为True时才生效 + :param paperWidth: 页面宽度(英寸),as_pdf为True时才生效 + :param paperHeight: 页面高度(英寸),as_pdf为True时才生效 + :param marginTop: 上边距(英寸),as_pdf为True时才生效 + :param marginBottom: 下边距(英寸),as_pdf为True时才生效 + :param marginLeft: 左边距(英寸),as_pdf为True时才生效 + :param marginRight: 右边距(英寸),as_pdf为True时才生效 + :param pageRanges: 页面范围,格式'1-5, 8, 11-13',as_pdf为True时才生效 + :param headerTemplate: 页头HTML模板,as_pdf为True时才生效 + 模板可包含以下class: + - date:日期 + - title:文档标题 + - url:文档url + - pageNumber:当前页码 + - totalPages:总页数 + 示例: + :param footerTemplate: 页脚HTML模板,格式与页头的一样,as_pdf为True时才生效 + :param preferCSSPageSize: 是否使用css定义的页面大小,as_pdf为True时才生效 + :param generateTaggedPDF: 是否生成带标签的(可访问的)PDF。默认为嵌入器选择,as_pdf为True时才生效 + :param generateDocumentOutline: 是否将文档大纲嵌入到PDF中。,as_pdf为True时才生效 + :return: as_pdf为True时返回bytes,否则返回文件文本 + """ + ... diff --git a/DrissionPage/_pages/mix_page.pyi b/DrissionPage/_pages/mix_page.pyi index 4dedd36..ef1cc6f 100644 --- a/DrissionPage/_pages/mix_page.pyi +++ b/DrissionPage/_pages/mix_page.pyi @@ -11,8 +11,8 @@ from requests import Session, Response from .chromium_frame import ChromiumFrame from .chromium_page import ChromiumPage +from .mix_tab import MixTab from .session_page import SessionPage -from .tabs import MixTab from .._base.base import BasePage from .._configs.chromium_options import ChromiumOptions from .._configs.session_options import SessionOptions diff --git a/DrissionPage/_pages/tabs.py b/DrissionPage/_pages/mix_tab.py similarity index 79% rename from DrissionPage/_pages/tabs.py rename to DrissionPage/_pages/mix_tab.py index 49be8d4..836ac6c 100644 --- a/DrissionPage/_pages/tabs.py +++ b/DrissionPage/_pages/mix_tab.py @@ -5,74 +5,14 @@ @Copyright: (c) 2024 by g1879, Inc. All Rights Reserved. @License : BSD 3-Clause. """ -from copy import copy -from time import sleep +from .chromium_tab import ChromiumTab from .._base.base import BasePage from .._configs.session_options import SessionOptions from .._functions.cookies import set_session_cookies, set_tab_cookies from .._functions.settings import Settings -from .._functions.web import save_page -from .._pages.chromium_base import ChromiumBase from .._pages.session_page import SessionPage -from .._units.setter import TabSetter, MixTabSetter -from .._units.waiter import TabWaiter - - -class ChromiumTab(ChromiumBase): - """实现浏览器标签页的类""" - _TABS = {} - - def __new__(cls, browser, tab_id): - if Settings.singleton_tab_obj and tab_id in cls._TABS: - r = cls._TABS[tab_id] - while not hasattr(r, '_frame_id'): - sleep(.1) - return r - r = object.__new__(cls) - cls._TABS[tab_id] = r - return r - - def __init__(self, browser, tab_id): - if Settings.singleton_tab_obj and hasattr(self, '_created'): - return - self._created = True - - super().__init__(browser, tab_id) - self._tab = self - self._type = 'ChromiumTab' - - def _d_set_runtime_settings(self): - self._timeouts = copy(self.browser.timeouts) - self.retry_times = self.browser.retry_times - self.retry_interval = self.browser.retry_interval - self._load_mode = self.browser._load_mode - self._download_path = self.browser.download_path - self._auto_handle_alert = self.browser._auto_handle_alert - - def close(self, others=False): - self.browser.close_tabs(self.tab_id, others=others) - - @property - def set(self): - if self._set is None: - self._set = TabSetter(self) - return self._set - - @property - def wait(self): - if self._wait is None: - self._wait = TabWaiter(self) - return self._wait - - def save(self, path=None, name=None, as_pdf=False, **kwargs): - return save_page(self, path, name, as_pdf, kwargs) - - def __repr__(self): - return f'' - - def _on_disconnect(self): - ChromiumTab._TABS.pop(self.tab_id, None) +from .._units.setter import MixTabSetter class MixTab(SessionPage, ChromiumTab, BasePage): diff --git a/DrissionPage/_pages/tabs.pyi b/DrissionPage/_pages/mix_tab.pyi similarity index 73% rename from DrissionPage/_pages/tabs.pyi rename to DrissionPage/_pages/mix_tab.pyi index 17934c6..bb87421 100644 --- a/DrissionPage/_pages/tabs.pyi +++ b/DrissionPage/_pages/mix_tab.pyi @@ -5,114 +5,20 @@ @Copyright: (c) 2024 by g1879, Inc. All Rights Reserved. @License : BSD 3-Clause. """ -from pathlib import Path from typing import Union, Tuple, Any, Optional, Literal from requests import Session, Response -from .chromium_base import ChromiumBase from .chromium_frame import ChromiumFrame +from .chromium_tab import ChromiumTab from .session_page import SessionPage -from .._base.browser import Chromium +from .._base.chromium import Chromium from .._elements.chromium_element import ChromiumElement from .._elements.session_element import SessionElement from .._functions.cookies import CookiesList from .._functions.elements import SessionElementsList, ChromiumElementsList -from .._units.rect import TabRect -from .._units.setter import TabSetter, MixTabSetter -from .._units.waiter import TabWaiter, MixTabWaiter - - -class ChromiumTab(ChromiumBase): - _TABS: dict = ... - _tab: ChromiumTab = ... - _rect: Optional[TabRect] = ... - - def __new__(cls, browser: Chromium, tab_id: str): - """ - :param browser: Browser对象 - :param tab_id: 标签页id - """ - ... - - def __init__(self, browser: Chromium, tab_id: str): - """ - :param browser: Browser对象 - :param tab_id: 标签页id - """ - ... - - def _d_set_runtime_settings(self) -> None: - """重写设置浏览器运行参数方法""" - ... - - def close(self, others: bool = False) -> None: - """关闭标签页 - :param others: 是否关闭其它,保留自己 - :return: None - """ - ... - - @property - def set(self) -> TabSetter: - """返回用于设置的对象""" - ... - - @property - def wait(self) -> TabWaiter: - """返回用于等待的对象""" - ... - - def save(self, - path: Union[str, Path] = None, - name: str = None, - as_pdf: bool = False, - landscape: bool = False, - displayHeaderFooter: bool = False, - printBackground: bool = False, - scale: float = 1, - paperWidth: float = 8.5, - paperHeight: float = 11, - marginTop: float = 11, - marginBottom: float = 1, - marginLeft: float = 1, - marginRight: float = 1, - pageRanges: str = '', - headerTemplate: str = '', - footerTemplate: str = '', - preferCSSPageSize: bool = False, - generateTaggedPDF: bool = ..., - generateDocumentOutline: bool = ...) -> Union[bytes, str]: - """把当前页面保存为文件,如果path和name参数都为None,只返回文本 - :param path: 保存路径,为None且name不为None时保存在当前路径 - :param name: 文件名,为None且path不为None时用title属性值 - :param as_pdf: 为Ture保存为pdf,否则为mhtml且忽略kwargs参数 - :param landscape: 纸张方向,as_pdf为True时才生效 - :param displayHeaderFooter: 是否显示页头页脚,as_pdf为True时才生效 - :param printBackground: 是否打印背景图片,as_pdf为True时才生效 - :param scale: 缩放比例,as_pdf为True时才生效 - :param paperWidth: 页面宽度(英寸),as_pdf为True时才生效 - :param paperHeight: 页面高度(英寸),as_pdf为True时才生效 - :param marginTop: 上边距(英寸),as_pdf为True时才生效 - :param marginBottom: 下边距(英寸),as_pdf为True时才生效 - :param marginLeft: 左边距(英寸),as_pdf为True时才生效 - :param marginRight: 右边距(英寸),as_pdf为True时才生效 - :param pageRanges: 页面范围,格式'1-5, 8, 11-13',as_pdf为True时才生效 - :param headerTemplate: 页头HTML模板,as_pdf为True时才生效 - 模板可包含以下class: - - date:日期 - - title:文档标题 - - url:文档url - - pageNumber:当前页码 - - totalPages:总页数 - 示例: - :param footerTemplate: 页脚HTML模板,格式与页头的一样,as_pdf为True时才生效 - :param preferCSSPageSize: 是否使用css定义的页面大小,as_pdf为True时才生效 - :param generateTaggedPDF: 是否生成带标签的(可访问的)PDF。默认为嵌入器选择,as_pdf为True时才生效 - :param generateDocumentOutline: 是否将文档大纲嵌入到PDF中。,as_pdf为True时才生效 - :return: as_pdf为True时返回bytes,否则返回文件文本 - """ - ... +from .._units.setter import MixTabSetter +from .._units.waiter import MixTabWaiter class MixTab(SessionPage, ChromiumTab): diff --git a/DrissionPage/_units/actions.pyi b/DrissionPage/_units/actions.pyi index 798c9c5..6a6934d 100644 --- a/DrissionPage/_units/actions.pyi +++ b/DrissionPage/_units/actions.pyi @@ -204,7 +204,7 @@ class Actions: def key_down(self, key: Union[KEYS, str]) -> Actions: """按下键盘上的按键, - :param key: 使用Keys获取的按键,或'DEL'形式按键名称 + :param key: 使用Keys获取的按键,或 'DEL' 形式按键名称 :return: self """ ... diff --git a/DrissionPage/_units/clicker.pyi b/DrissionPage/_units/clicker.pyi index b3c181e..efbe999 100644 --- a/DrissionPage/_units/clicker.pyi +++ b/DrissionPage/_units/clicker.pyi @@ -10,7 +10,8 @@ from typing import Union from .downloader import DownloadMission from .._elements.chromium_element import ChromiumElement -from .._pages.tabs import MixTab, ChromiumTab +from .._pages.chromium_tab import ChromiumTab +from .._pages.mix_tab import MixTab class Clicker(object): diff --git a/DrissionPage/_units/cookies_setter.pyi b/DrissionPage/_units/cookies_setter.pyi index a3b8560..4301e40 100644 --- a/DrissionPage/_units/cookies_setter.pyi +++ b/DrissionPage/_units/cookies_setter.pyi @@ -8,11 +8,11 @@ from http.cookiejar import Cookie, CookieJar from typing import Union -from .._base.browser import Chromium +from .._base.chromium import Chromium from .._pages.chromium_base import ChromiumBase -from .._pages.tabs import MixTab -from .._pages.session_page import SessionPage from .._pages.mix_page import MixPage +from .._pages.mix_tab import MixTab +from .._pages.session_page import SessionPage class BrowserCookiesSetter(object): diff --git a/DrissionPage/_units/downloader.pyi b/DrissionPage/_units/downloader.pyi index b719cbf..6030f6b 100644 --- a/DrissionPage/_units/downloader.pyi +++ b/DrissionPage/_units/downloader.pyi @@ -7,7 +7,7 @@ """ from typing import Dict, Optional, Union, Literal -from .._base.browser import Chromium +from .._base.chromium import Chromium from .._pages.chromium_base import ChromiumBase FILE_EXISTS = Literal['skip', 'rename', 'overwrite', 's', 'r', 'o'] diff --git a/DrissionPage/_units/rect.pyi b/DrissionPage/_units/rect.pyi index b24eaba..0a1a8c7 100644 --- a/DrissionPage/_units/rect.pyi +++ b/DrissionPage/_units/rect.pyi @@ -5,15 +5,15 @@ @Copyright: (c) 2024 by g1879, Inc. All Rights Reserved. @License : BSD 3-Clause. """ - from typing import Tuple, Union from .._elements.chromium_element import ChromiumElement from .._pages.chromium_base import ChromiumBase from .._pages.chromium_frame import ChromiumFrame from .._pages.chromium_page import ChromiumPage -from .._pages.tabs import ChromiumTab, MixTab +from .._pages.chromium_tab import ChromiumTab from .._pages.mix_page import MixPage +from .._pages.mix_tab import MixTab class ElementRect(object): diff --git a/DrissionPage/_units/scroller.pyi b/DrissionPage/_units/scroller.pyi index a97c4fa..a514e06 100644 --- a/DrissionPage/_units/scroller.pyi +++ b/DrissionPage/_units/scroller.pyi @@ -11,8 +11,9 @@ from .._elements.chromium_element import ChromiumElement from .._pages.chromium_base import ChromiumBase from .._pages.chromium_frame import ChromiumFrame from .._pages.chromium_page import ChromiumPage +from .._pages.chromium_tab import ChromiumTab from .._pages.mix_page import MixPage -from .._pages.tabs import ChromiumTab, MixTab +from .._pages.mix_tab import MixTab class Scroller(object): diff --git a/DrissionPage/_units/setter.pyi b/DrissionPage/_units/setter.pyi index 9ea7692..271dffd 100644 --- a/DrissionPage/_units/setter.pyi +++ b/DrissionPage/_units/setter.pyi @@ -14,14 +14,15 @@ from requests.auth import HTTPBasicAuth from .cookies_setter import SessionCookiesSetter, CookiesSetter, MixPageCookiesSetter, BrowserCookiesSetter from .scroller import PageScroller from .._base.base import BasePage -from .._base.browser import Chromium +from .._base.chromium import Chromium from .._elements.chromium_element import ChromiumElement from .._pages.chromium_base import ChromiumBase from .._pages.chromium_frame import ChromiumFrame from .._pages.chromium_page import ChromiumPage -from .._pages.tabs import ChromiumTab, MixTab -from .._pages.session_page import SessionPage +from .._pages.chromium_tab import ChromiumTab from .._pages.mix_page import MixPage +from .._pages.mix_tab import MixTab +from .._pages.session_page import SessionPage FILE_EXISTS = Literal['skip', 'rename', 'overwrite', 's', 'r', 'o'] diff --git a/DrissionPage/_units/states.pyi b/DrissionPage/_units/states.pyi index fc0fb0e..dcf4fe9 100644 --- a/DrissionPage/_units/states.pyi +++ b/DrissionPage/_units/states.pyi @@ -7,7 +7,7 @@ """ from typing import Union, Tuple, List, Optional, Literal -from .._base.browser import Chromium +from .._base.chromium import Chromium from .._elements.chromium_element import ShadowRoot, ChromiumElement from .._pages.chromium_base import ChromiumBase from .._pages.chromium_frame import ChromiumFrame diff --git a/DrissionPage/_units/waiter.pyi b/DrissionPage/_units/waiter.pyi index c74d6dc..65807b8 100644 --- a/DrissionPage/_units/waiter.pyi +++ b/DrissionPage/_units/waiter.pyi @@ -8,13 +8,14 @@ from typing import Union, Tuple, List, Any from .downloader import DownloadMission -from .._base.browser import Chromium +from .._base.chromium import Chromium from .._elements.chromium_element import ChromiumElement from .._pages.chromium_base import ChromiumBase from .._pages.chromium_frame import ChromiumFrame from .._pages.chromium_page import ChromiumPage +from .._pages.chromium_tab import ChromiumTab from .._pages.mix_page import MixPage -from .._pages.tabs import ChromiumTab, MixTab +from .._pages.mix_tab import MixTab class OriginWaiter(object): diff --git a/DrissionPage/common.py b/DrissionPage/common.py index e7a0717..ee0942d 100644 --- a/DrissionPage/common.py +++ b/DrissionPage/common.py @@ -5,7 +5,7 @@ @Copyright: (c) 2024 by g1879, Inc. All Rights Reserved. @License : BSD 3-Clause. """ -from ._base.browser import Chromium +from ._base.chromium import Chromium from ._elements.session_element import make_session_ele from ._functions.by import By from ._functions.elements import get_eles diff --git a/DrissionPage/items.py b/DrissionPage/items.py index de7de6f..146fb96 100644 --- a/DrissionPage/items.py +++ b/DrissionPage/items.py @@ -9,8 +9,9 @@ from ._elements.chromium_element import ChromiumElement, ShadowRoot from ._elements.none_element import NoneElement from ._elements.session_element import SessionElement from ._pages.chromium_frame import ChromiumFrame -from ._pages.tabs import ChromiumTab, MixTab -from ._pages.tabs import MixTab as WebPageTab +from ._pages.chromium_tab import ChromiumTab +from ._pages.mix_tab import MixTab +from ._pages.mix_tab import MixTab as WebPageTab __all__ = ['ChromiumElement', 'ShadowRoot', 'NoneElement', 'SessionElement', 'ChromiumFrame', 'ChromiumTab', 'MixTab', 'WebPageTab'] diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index 25578be..0000000 --- a/docs/index.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - DrissionPage - - - - - - - - - - - - - - - - - - - - \ No newline at end of file