增加wait()方法

This commit is contained in:
g1879 2023-08-30 17:33:00 +08:00
parent 8170d53c97
commit 0b96412146
3 changed files with 20 additions and 0 deletions

View File

@ -80,6 +80,8 @@ class SessionPageSetter(object):
def retry_interval(self, interval: float) -> None: ...
def download_path(self, path: Union[str, Path]) -> None: ...
def timeout(self, second: float) -> None: ...
def cookie(self, cookie: Union[Cookie, str, dict]) -> None: ...

View File

@ -12,6 +12,13 @@ class ChromiumBaseWaiter(object):
"""
self._driver = page_or_ele
def __call__(self, second):
"""等待若干秒
:param second: 秒数
:return: None
"""
sleep(second)
def ele_delete(self, loc_or_ele, timeout=None, raise_err=None):
"""等待元素从DOM中删除
:param loc_or_ele: 要等待的元素可以是已有元素定位符
@ -223,6 +230,13 @@ class ChromiumElementWaiter(object):
self._page = page
self._ele = ele
def __call__(self, second):
"""等待若干秒
:param second: 秒数
:return: None
"""
sleep(second)
def delete(self, timeout=None, raise_err=None):
"""等待元素从dom删除
:param timeout: 超时时间为None使用元素所在页面timeout属性

View File

@ -15,6 +15,8 @@ class ChromiumBaseWaiter(object):
def __init__(self, page: ChromiumBase):
self._driver: ChromiumBase = ...
def __call__(self, second: float) -> None: ...
def ele_delete(self, loc_or_ele: Union[str, tuple, ChromiumElement], timeout: float = None,
raise_err: bool = None) -> bool: ...
@ -60,6 +62,8 @@ class ChromiumElementWaiter(object):
self._ele: ChromiumElement = ...
self._page: ChromiumBase = ...
def __call__(self, second: float) -> None: ...
def delete(self, timeout: float = None, raise_err: bool = None) -> bool: ...
def display(self, timeout: float = None, raise_err: bool = None) -> bool: ...