mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
修改注释,ele()只返回元素
This commit is contained in:
parent
e9f6322e5e
commit
4adb8247fd
@ -1149,7 +1149,7 @@ def find_by_xpath(ele, xpath, single, timeout, relative=True):
|
||||
return NoneElement(ele.page) if r['result']['subtype'] == 'null' \
|
||||
else make_chromium_ele(ele.page, obj_id=r['result']['objectId'])
|
||||
|
||||
if r['result']['description'] == 'NodeList(0)':
|
||||
if r['result']['description'] in ('NodeList(0)', 'Array(0)'):
|
||||
return []
|
||||
else:
|
||||
r = ele.page.run_cdp_loaded('Runtime.getProperties', objectId=r['result']['objectId'],
|
||||
@ -1176,7 +1176,7 @@ def find_by_css(ele, selector, single, timeout):
|
||||
|
||||
end_time = perf_counter() + timeout
|
||||
while ('exceptionDetails' in r or r['result']['subtype'] == 'null' or
|
||||
r['result']['description'] == 'NodeList(0)') and perf_counter() < end_time:
|
||||
r['result']['description'] in ('NodeList(0)', 'Array(0)')) and perf_counter() < end_time:
|
||||
r = ele.page.run_cdp_loaded('Runtime.callFunctionOn', functionDeclaration=js, objectId=ele._obj_id,
|
||||
returnByValue=False, awaitPromise=True, userGesture=True)
|
||||
|
||||
@ -1187,7 +1187,7 @@ def find_by_css(ele, selector, single, timeout):
|
||||
return NoneElement(ele.page) if r['result']['subtype'] == 'null' \
|
||||
else make_chromium_ele(ele.page, obj_id=r['result']['objectId'])
|
||||
|
||||
if r['result']['description'] == 'NodeList(0)':
|
||||
if r['result']['description'] in ('NodeList(0)', 'Array(0)'):
|
||||
return []
|
||||
else:
|
||||
r = ele.page.run_cdp_loaded('Runtime.getProperties', objectId=r['result']['objectId'],
|
||||
|
@ -45,7 +45,7 @@ class ChromiumElement(DrissionElement):
|
||||
def __repr__(self) -> str: ...
|
||||
|
||||
def __call__(self, loc_or_str: Union[Tuple[str, str], str],
|
||||
timeout: float = None) -> Union[ChromiumElement, str, None]: ...
|
||||
timeout: float = None) -> Union[ChromiumElement, NoneElement]: ...
|
||||
|
||||
@property
|
||||
def tag(self) -> str: ...
|
||||
@ -91,50 +91,62 @@ class ChromiumElement(DrissionElement):
|
||||
@property
|
||||
def click(self) -> Clicker: ...
|
||||
|
||||
def parent(self, level_or_loc: Union[tuple, str, int] = 1, index: int = 1) -> Union[ChromiumElement, None]: ...
|
||||
def parent(self,
|
||||
level_or_loc: Union[tuple, str, int] = 1,
|
||||
index: int = 1) -> Union[ChromiumElement, NoneElement]: ...
|
||||
|
||||
def child(self, filter_loc: Union[tuple, str, int] = '',
|
||||
def child(self,
|
||||
filter_loc: Union[tuple, str, int] = '',
|
||||
index: int = 1,
|
||||
timeout: float = 0,
|
||||
ele_only: bool = True) -> Union[ChromiumElement, str, None]: ...
|
||||
ele_only: bool = True) -> Union[ChromiumElement, str, NoneElement]: ...
|
||||
|
||||
def prev(self, filter_loc: Union[tuple, str, int] = '',
|
||||
def prev(self,
|
||||
filter_loc: Union[tuple, str, int] = '',
|
||||
index: int = 1,
|
||||
timeout: float = 0,
|
||||
ele_only: bool = True) -> Union[ChromiumElement, str, None]: ...
|
||||
ele_only: bool = True) -> Union[ChromiumElement, str, NoneElement]: ...
|
||||
|
||||
def next(self, filter_loc: Union[tuple, str, int] = '',
|
||||
def next(self,
|
||||
filter_loc: Union[tuple, str, int] = '',
|
||||
index: int = 1,
|
||||
timeout: float = 0,
|
||||
ele_only: bool = True) -> Union[ChromiumElement, str, None]: ...
|
||||
ele_only: bool = True) -> Union[ChromiumElement, str, NoneElement]: ...
|
||||
|
||||
def before(self, filter_loc: Union[tuple, str, int] = '',
|
||||
def before(self,
|
||||
filter_loc: Union[tuple, str, int] = '',
|
||||
index: int = 1,
|
||||
timeout: float = None,
|
||||
ele_only: bool = True) -> Union[ChromiumElement, str, None]: ...
|
||||
ele_only: bool = True) -> Union[ChromiumElement, str, NoneElement]: ...
|
||||
|
||||
def after(self, filter_loc: Union[tuple, str, int] = '',
|
||||
def after(self,
|
||||
filter_loc: Union[tuple, str, int] = '',
|
||||
index: int = 1,
|
||||
timeout: float = None,
|
||||
ele_only: bool = True) -> Union[ChromiumElement, str, None]: ...
|
||||
ele_only: bool = True) -> Union[ChromiumElement, str, NoneElement]: ...
|
||||
|
||||
def children(self, filter_loc: Union[tuple, str] = '',
|
||||
def children(self,
|
||||
filter_loc: Union[tuple, str] = '',
|
||||
timeout: float = 0,
|
||||
ele_only: bool = True) -> List[Union[ChromiumElement, str]]: ...
|
||||
|
||||
def prevs(self, filter_loc: Union[tuple, str] = '',
|
||||
def prevs(self,
|
||||
filter_loc: Union[tuple, str] = '',
|
||||
timeout: float = 0,
|
||||
ele_only: bool = True) -> List[Union[ChromiumElement, str]]: ...
|
||||
|
||||
def nexts(self, filter_loc: Union[tuple, str] = '',
|
||||
def nexts(self,
|
||||
filter_loc: Union[tuple, str] = '',
|
||||
timeout: float = 0,
|
||||
ele_only: bool = True) -> List[Union[ChromiumElement, str]]: ...
|
||||
|
||||
def befores(self, filter_loc: Union[tuple, str] = '',
|
||||
def befores(self,
|
||||
filter_loc: Union[tuple, str] = '',
|
||||
timeout: float = None,
|
||||
ele_only: bool = True) -> List[Union[ChromiumElement, str]]: ...
|
||||
|
||||
def afters(self, filter_loc: Union[tuple, str] = '',
|
||||
def afters(self,
|
||||
filter_loc: Union[tuple, str] = '',
|
||||
timeout: float = None,
|
||||
ele_only: bool = True) -> List[Union[ChromiumElement, str]]: ...
|
||||
|
||||
@ -156,20 +168,25 @@ class ChromiumElement(DrissionElement):
|
||||
|
||||
def run_async_js(self, script: str, *args, as_expr: bool = False, timeout: float = None) -> None: ...
|
||||
|
||||
def ele(self, loc_or_str: Union[Tuple[str, str], str],
|
||||
timeout: float = None) -> Union[ChromiumElement, str]: ...
|
||||
def ele(self,
|
||||
loc_or_str: Union[Tuple[str, str], str],
|
||||
timeout: float = None) -> Union[ChromiumElement, NoneElement]: ...
|
||||
|
||||
def eles(self, loc_or_str: Union[Tuple[str, str], str],
|
||||
timeout: float = None) -> List[Union[ChromiumElement, str]]: ...
|
||||
def eles(self,
|
||||
loc_or_str: Union[Tuple[str, str], str],
|
||||
timeout: float = None) -> List[ChromiumElement]: ...
|
||||
|
||||
def s_ele(self, loc_or_str: Union[Tuple[str, str], str] = None) -> Union[SessionElement, str, NoneElement]: ...
|
||||
def s_ele(self, loc_or_str: Union[Tuple[str, str], str] = None) -> Union[SessionElement, NoneElement]: ...
|
||||
|
||||
def s_eles(self, loc_or_str: Union[Tuple[str, str], str] = None) -> List[Union[SessionElement, str]]: ...
|
||||
def s_eles(self, loc_or_str: Union[Tuple[str, str], str] = None) -> List[SessionElement]: ...
|
||||
|
||||
def _find_elements(self, loc_or_str: Union[Tuple[str, str], str], timeout: float = None,
|
||||
single: bool = True, relative: bool = False, raise_err: bool = False) \
|
||||
-> Union[ChromiumElement, ChromiumFrame, str, NoneElement,
|
||||
List[Union[ChromiumElement, ChromiumFrame, str]]]: ...
|
||||
def _find_elements(self,
|
||||
loc_or_str: Union[Tuple[str, str], str],
|
||||
timeout: float = None,
|
||||
single: bool = True,
|
||||
relative: bool = False,
|
||||
raise_err: bool = False) -> Union[ChromiumElement, ChromiumFrame, NoneElement,
|
||||
List[Union[ChromiumElement, ChromiumFrame]]]: ...
|
||||
|
||||
def style(self, style: str, pseudo_ele: str = '') -> str: ...
|
||||
|
||||
@ -177,8 +194,12 @@ class ChromiumElement(DrissionElement):
|
||||
|
||||
def save(self, path: [str, bool] = None, name: str = None, timeout: float = None) -> str: ...
|
||||
|
||||
def get_screenshot(self, path: [str, Path] = None, name: str = None, as_bytes: PIC_TYPE = None,
|
||||
as_base64: PIC_TYPE = None, scroll_to_center: bool = True) -> Union[str, bytes]: ...
|
||||
def get_screenshot(self,
|
||||
path: [str, Path] = None,
|
||||
name: str = None,
|
||||
as_bytes: PIC_TYPE = None,
|
||||
as_base64: PIC_TYPE = None,
|
||||
scroll_to_center: bool = True) -> Union[str, bytes]: ...
|
||||
|
||||
def input(self, vals: Any, clear: bool = True, by_js: bool = False) -> None: ...
|
||||
|
||||
@ -239,34 +260,34 @@ class ShadowRoot(BaseElement):
|
||||
def parent(self, level_or_loc: Union[str, int] = 1, index: int = 1) -> ChromiumElement: ...
|
||||
|
||||
def child(self, filter_loc: Union[tuple, str] = '',
|
||||
index: int = 1) -> Union[ChromiumElement, str, None]: ...
|
||||
index: int = 1) -> Union[ChromiumElement, NoneElement]: ...
|
||||
|
||||
def next(self, filter_loc: Union[tuple, str] = '',
|
||||
index: int = 1) -> Union[ChromiumElement, str, None]: ...
|
||||
index: int = 1) -> Union[ChromiumElement, NoneElement]: ...
|
||||
|
||||
def before(self, filter_loc: Union[tuple, str] = '',
|
||||
index: int = 1) -> Union[ChromiumElement, str, None]: ...
|
||||
index: int = 1) -> Union[ChromiumElement, NoneElement]: ...
|
||||
|
||||
def after(self, filter_loc: Union[tuple, str] = '',
|
||||
index: int = 1) -> Union[ChromiumElement, str, None]: ...
|
||||
index: int = 1) -> Union[ChromiumElement, NoneElement]: ...
|
||||
|
||||
def children(self, filter_loc: Union[tuple, str] = '') -> List[Union[ChromiumElement, str]]: ...
|
||||
def children(self, filter_loc: Union[tuple, str] = '') -> List[ChromiumElement]: ...
|
||||
|
||||
def nexts(self, filter_loc: Union[tuple, str] = '') -> List[Union[ChromiumElement, str]]: ...
|
||||
def nexts(self, filter_loc: Union[tuple, str] = '') -> List[ChromiumElement]: ...
|
||||
|
||||
def befores(self, filter_loc: Union[tuple, str] = '') -> List[Union[ChromiumElement, str]]: ...
|
||||
def befores(self, filter_loc: Union[tuple, str] = '') -> List[ChromiumElement]: ...
|
||||
|
||||
def afters(self, filter_loc: Union[tuple, str] = '') -> List[Union[ChromiumElement, str]]: ...
|
||||
def afters(self, filter_loc: Union[tuple, str] = '') -> List[ChromiumElement]: ...
|
||||
|
||||
def ele(self, loc_or_str: Union[Tuple[str, str], str],
|
||||
timeout: float = None) -> Union[ChromiumElement]: ...
|
||||
timeout: float = None) -> Union[ChromiumElement, NoneElement]: ...
|
||||
|
||||
def eles(self, loc_or_str: Union[Tuple[str, str], str],
|
||||
timeout: float = None) -> List[ChromiumElement]: ...
|
||||
|
||||
def s_ele(self, loc_or_str: Union[Tuple[str, str], str] = None) -> Union[SessionElement, str, NoneElement]: ...
|
||||
def s_ele(self, loc_or_str: Union[Tuple[str, str], str] = None) -> Union[SessionElement, NoneElement]: ...
|
||||
|
||||
def s_eles(self, loc_or_str: Union[Tuple[str, str], str]) -> List[Union[SessionElement, str]]: ...
|
||||
def s_eles(self, loc_or_str: Union[Tuple[str, str], str]) -> List[SessionElement]: ...
|
||||
|
||||
def _find_elements(self, loc_or_str: Union[Tuple[str, str], str], timeout: float = None,
|
||||
single: bool = True, relative: bool = False, raise_err: bool = None) \
|
||||
@ -282,7 +303,7 @@ class ShadowRoot(BaseElement):
|
||||
|
||||
def find_in_chromium_ele(ele: ChromiumElement, loc: Union[str, Tuple[str, str]],
|
||||
single: bool = True, timeout: float = None, relative: bool = True) \
|
||||
-> Union[ChromiumElement, str, NoneElement, List[Union[ChromiumElement, str]]]: ...
|
||||
-> Union[ChromiumElement, NoneElement, List[ChromiumElement]]: ...
|
||||
|
||||
|
||||
def find_by_xpath(ele: ChromiumElement, xpath: str, single: bool, timeout: float,
|
||||
|
@ -3,7 +3,7 @@
|
||||
@Author : g1879
|
||||
@Contact : g1879@qq.com
|
||||
"""
|
||||
from typing import Union, List, Tuple
|
||||
from typing import Union, List, Tuple, Optional
|
||||
|
||||
from lxml.html import HtmlElement
|
||||
|
||||
@ -28,7 +28,7 @@ class SessionElement(DrissionElement):
|
||||
|
||||
def __call__(self,
|
||||
loc_or_str: Union[Tuple[str, str], str],
|
||||
timeout: float = None) -> Union['SessionElement', str, None]: ...
|
||||
timeout: float = None) -> Union[SessionElement, NoneElement]: ...
|
||||
|
||||
@property
|
||||
def tag(self) -> str: ...
|
||||
@ -48,68 +48,80 @@ class SessionElement(DrissionElement):
|
||||
@property
|
||||
def raw_text(self) -> str: ...
|
||||
|
||||
def parent(self, level_or_loc: Union[tuple, str, int] = 1, index: int = 1) -> Union['SessionElement', None]: ...
|
||||
def parent(self,
|
||||
level_or_loc: Union[tuple, str, int] = 1,
|
||||
index: int = 1) -> Union[SessionElement, NoneElement]: ...
|
||||
|
||||
def child(self, filter_loc: Union[tuple, str, int] = '',
|
||||
def child(self,
|
||||
filter_loc: Union[tuple, str, int] = '',
|
||||
index: int = 1,
|
||||
timeout: float = None,
|
||||
ele_only: bool = True) -> Union['SessionElement', str, None]: ...
|
||||
ele_only: bool = True) -> Union[SessionElement, str, NoneElement]: ...
|
||||
|
||||
def prev(self, filter_loc: Union[tuple, str, int] = '',
|
||||
def prev(self,
|
||||
filter_loc: Union[tuple, str, int] = '',
|
||||
index: int = 1,
|
||||
timeout: float = None,
|
||||
ele_only: bool = True) -> Union['SessionElement', str, None]: ...
|
||||
ele_only: bool = True) -> Union[SessionElement, str, NoneElement]: ...
|
||||
|
||||
def next(self, filter_loc: Union[tuple, str, int] = '',
|
||||
def next(self,
|
||||
filter_loc: Union[tuple, str, int] = '',
|
||||
index: int = 1,
|
||||
timeout: float = None,
|
||||
ele_only: bool = True) -> Union['SessionElement', str, None]: ...
|
||||
ele_only: bool = True) -> Union[SessionElement, str, NoneElement]: ...
|
||||
|
||||
def before(self, filter_loc: Union[tuple, str, int] = '',
|
||||
def before(self,
|
||||
filter_loc: Union[tuple, str, int] = '',
|
||||
index: int = 1,
|
||||
timeout: float = None,
|
||||
ele_only: bool = True) -> Union['SessionElement', str, None]: ...
|
||||
ele_only: bool = True) -> Union[SessionElement, str, NoneElement]: ...
|
||||
|
||||
def after(self, filter_loc: Union[tuple, str, int] = '',
|
||||
def after(self,
|
||||
filter_loc: Union[tuple, str, int] = '',
|
||||
index: int = 1,
|
||||
timeout: float = None,
|
||||
ele_only: bool = True) -> Union['SessionElement', str, None]: ...
|
||||
ele_only: bool = True) -> Union[SessionElement, str, NoneElement]: ...
|
||||
|
||||
def children(self, filter_loc: Union[tuple, str] = '',
|
||||
def children(self,
|
||||
filter_loc: Union[tuple, str] = '',
|
||||
timeout: float = None,
|
||||
ele_only: bool = True) -> List[Union['SessionElement', str]]: ...
|
||||
ele_only: bool = True) -> List[Union[SessionElement, str]]: ...
|
||||
|
||||
def prevs(self, filter_loc: Union[tuple, str] = '',
|
||||
def prevs(self,
|
||||
filter_loc: Union[tuple, str] = '',
|
||||
timeout: float = None,
|
||||
ele_only: bool = True) -> List[Union['SessionElement', str]]: ...
|
||||
ele_only: bool = True) -> List[Union[SessionElement, str]]: ...
|
||||
|
||||
def nexts(self, filter_loc: Union[tuple, str] = '',
|
||||
def nexts(self,
|
||||
filter_loc: Union[tuple, str] = '',
|
||||
timeout: float = None,
|
||||
ele_only: bool = True) -> List[Union['SessionElement', str]]: ...
|
||||
ele_only: bool = True) -> List[Union[SessionElement, str]]: ...
|
||||
|
||||
def befores(self, filter_loc: Union[tuple, str] = '',
|
||||
def befores(self,
|
||||
filter_loc: Union[tuple, str] = '',
|
||||
timeout: float = None,
|
||||
ele_only: bool = True) -> List[Union['SessionElement', str]]: ...
|
||||
ele_only: bool = True) -> List[Union[SessionElement, str]]: ...
|
||||
|
||||
def afters(self, filter_loc: Union[tuple, str] = '',
|
||||
def afters(self,
|
||||
filter_loc: Union[tuple, str] = '',
|
||||
timeout: float = None,
|
||||
ele_only: bool = True) -> List[Union['SessionElement', str]]: ...
|
||||
ele_only: bool = True) -> List[Union[SessionElement, str]]: ...
|
||||
|
||||
def attr(self, attr: str) -> Union[str, None]: ...
|
||||
def attr(self, attr: str) -> Optional[str]: ...
|
||||
|
||||
def ele(self,
|
||||
loc_or_str: Union[Tuple[str, str], str],
|
||||
timeout: float = None) -> Union['SessionElement', str, NoneElement]: ...
|
||||
timeout: float = None) -> Union[SessionElement, NoneElement]: ...
|
||||
|
||||
def eles(self,
|
||||
loc_or_str: Union[Tuple[str, str], str],
|
||||
timeout: float = None) -> List[Union['SessionElement', str]]: ...
|
||||
timeout: float = None) -> List[SessionElement]: ...
|
||||
|
||||
def s_ele(self,
|
||||
loc_or_str: Union[Tuple[str, str], str] = None) -> Union['SessionElement', str, NoneElement]: ...
|
||||
loc_or_str: Union[Tuple[str, str], str] = None) -> Union[SessionElement, NoneElement]: ...
|
||||
|
||||
def s_eles(self,
|
||||
loc_or_str: Union[Tuple[str, str], str]) -> List[Union['SessionElement', str]]: ...
|
||||
loc_or_str: Union[Tuple[str, str], str]) -> List[SessionElement]: ...
|
||||
|
||||
def _find_elements(self,
|
||||
loc_or_str: Union[Tuple[str, str], str],
|
||||
@ -117,7 +129,7 @@ class SessionElement(DrissionElement):
|
||||
single: bool = True,
|
||||
relative: bool = False,
|
||||
raise_err: bool = None) \
|
||||
-> Union['SessionElement', str, NoneElement, List[Union['SessionElement', str]]]: ...
|
||||
-> Union[SessionElement, NoneElement, List[SessionElement]]: ...
|
||||
|
||||
def _get_ele_path(self, mode: str) -> str: ...
|
||||
|
||||
@ -126,4 +138,4 @@ def make_session_ele(html_or_ele: Union[str, SessionElement, SessionPage, Chromi
|
||||
ChromiumBase],
|
||||
loc: Union[str, Tuple[str, str]] = None,
|
||||
single: bool = True) -> Union[
|
||||
SessionElement, str, NoneElement, List[Union[SessionElement, str]]]: ...
|
||||
SessionElement, NoneElement, List[SessionElement]]: ...
|
||||
|
@ -91,7 +91,7 @@ class ChromiumBase(BasePage):
|
||||
def _d_set_runtime_settings(self) -> None: ...
|
||||
|
||||
def __call__(self, loc_or_str: Union[Tuple[str, str], str, ChromiumElement],
|
||||
timeout: float = None) -> ChromiumElement: ...
|
||||
timeout: float = None) -> Union[ChromiumElement, NoneElement]: ...
|
||||
|
||||
@property
|
||||
def _js_ready_state(self) -> str: ...
|
||||
@ -175,15 +175,15 @@ class ChromiumBase(BasePage):
|
||||
all_info: bool = False) -> Union[list, dict]: ...
|
||||
|
||||
def ele(self, loc_or_ele: Union[Tuple[str, str], str, ChromiumElement, ChromiumFrame],
|
||||
timeout: float = None) -> Union[ChromiumElement, str]: ...
|
||||
timeout: float = None) -> Union[ChromiumElement, NoneElement]: ...
|
||||
|
||||
def eles(self, loc_or_str: Union[Tuple[str, str], str],
|
||||
timeout: float = None) -> List[Union[ChromiumElement, str]]: ...
|
||||
timeout: float = None) -> List[ChromiumElement]: ...
|
||||
|
||||
def s_ele(self, loc_or_ele: Union[Tuple[str, str], str] = None) \
|
||||
-> Union[SessionElement, str, NoneElement]: ...
|
||||
-> Union[SessionElement, NoneElement]: ...
|
||||
|
||||
def s_eles(self, loc_or_str: Union[Tuple[str, str], str]) -> List[Union[SessionElement, str]]: ...
|
||||
def s_eles(self, loc_or_str: Union[Tuple[str, str], str]) -> List[SessionElement]: ...
|
||||
|
||||
def _find_elements(self, loc_or_ele: Union[Tuple[str, str], str, ChromiumElement, ChromiumFrame],
|
||||
timeout: float = None, single: bool = True, relative: bool = False, raise_err: bool = None) \
|
||||
|
@ -11,6 +11,7 @@ from .chromium_page import ChromiumPage
|
||||
from .chromium_tab import ChromiumTab
|
||||
from .web_page import WebPage
|
||||
from .._elements.chromium_element import ChromiumElement
|
||||
from .._elements.none_element import NoneElement
|
||||
from .._units.listener import FrameListener
|
||||
from .._units.rect import FrameRect
|
||||
from .._units.scroller import FrameScroller
|
||||
@ -21,7 +22,9 @@ from .._units.waiter import FrameWaiter
|
||||
|
||||
class ChromiumFrame(ChromiumBase):
|
||||
|
||||
def __init__(self, page: Union[ChromiumPage, WebPage, ChromiumTab, ChromiumFrame], ele: ChromiumElement):
|
||||
def __init__(self,
|
||||
page: Union[ChromiumPage, WebPage, ChromiumTab, ChromiumFrame],
|
||||
ele: ChromiumElement):
|
||||
self._page: ChromiumPage = ...
|
||||
self._target_page: ChromiumBase = ...
|
||||
self.tab: ChromiumTab = ...
|
||||
@ -36,8 +39,9 @@ class ChromiumFrame(ChromiumBase):
|
||||
self._rect: FrameRect = ...
|
||||
self._listener: FrameListener = ...
|
||||
|
||||
def __call__(self, loc_or_str: Union[Tuple[str, str], str],
|
||||
timeout: float = None) -> Union[ChromiumElement, str]: ...
|
||||
def __call__(self,
|
||||
loc_or_str: Union[Tuple[str, str], str],
|
||||
timeout: float = None) -> Union[ChromiumElement, NoneElement]: ...
|
||||
|
||||
def _check_alive(self) -> None: ...
|
||||
|
||||
@ -127,43 +131,82 @@ class ChromiumFrame(ChromiumBase):
|
||||
|
||||
def remove_attr(self, attr: str) -> None: ...
|
||||
|
||||
def run_js(self, script: str, *args, as_expr: bool = False, timeout: float = None) -> Any: ...
|
||||
def run_js(self,
|
||||
script: str,
|
||||
*args,
|
||||
as_expr: bool = False,
|
||||
timeout: float = None) -> Any: ...
|
||||
|
||||
def parent(self, level_or_loc: Union[tuple, str, int] = 1, index: int = 1) -> Union[ChromiumElement, None]: ...
|
||||
def parent(self,
|
||||
level_or_loc: Union[tuple, str, int] = 1,
|
||||
index: int = 1) -> Union[ChromiumElement, NoneElement]: ...
|
||||
|
||||
def prev(self, filter_loc: Union[tuple, str, int] = '', index: int = 1,
|
||||
timeout: float = 0, ele_only: bool = True) -> Union[ChromiumElement, str]: ...
|
||||
def prev(self,
|
||||
filter_loc: Union[tuple, str, int] = '',
|
||||
index: int = 1,
|
||||
timeout: float = 0,
|
||||
ele_only: bool = True) -> Union[ChromiumElement, NoneElement, str]: ...
|
||||
|
||||
def next(self, filter_loc: Union[tuple, str, int] = '', index: int = 1,
|
||||
timeout: float = 0, ele_only: bool = True) -> Union[ChromiumElement, str]: ...
|
||||
def next(self,
|
||||
filter_loc: Union[tuple, str, int] = '',
|
||||
index: int = 1,
|
||||
timeout: float = 0,
|
||||
ele_only: bool = True) -> Union[ChromiumElement, NoneElement, str]: ...
|
||||
|
||||
def before(self, filter_loc: Union[tuple, str, int] = '', index: int = 1,
|
||||
timeout: float = None, ele_only: bool = True) -> Union[ChromiumElement, str]: ...
|
||||
def before(self,
|
||||
filter_loc: Union[tuple, str, int] = '',
|
||||
index: int = 1,
|
||||
timeout: float = None,
|
||||
ele_only: bool = True) -> Union[ChromiumElement, NoneElement, str]: ...
|
||||
|
||||
def after(self, filter_loc: Union[tuple, str, int] = '', index: int = 1,
|
||||
timeout: float = None, ele_only: bool = True) -> Union[ChromiumElement, str]: ...
|
||||
def after(self,
|
||||
filter_loc: Union[tuple, str, int] = '',
|
||||
index: int = 1,
|
||||
timeout: float = None,
|
||||
ele_only: bool = True) -> Union[ChromiumElement, NoneElement, str]: ...
|
||||
|
||||
def prevs(self, filter_loc: Union[tuple, str] = '', timeout: float = 0,
|
||||
def prevs(self,
|
||||
filter_loc: Union[tuple, str] = '',
|
||||
timeout: float = 0,
|
||||
ele_only: bool = True) -> List[Union[ChromiumElement, str]]: ...
|
||||
|
||||
def nexts(self, filter_loc: Union[tuple, str] = '', timeout: float = 0,
|
||||
def nexts(self,
|
||||
filter_loc: Union[tuple, str] = '',
|
||||
timeout: float = 0,
|
||||
ele_only: bool = True) -> List[Union[ChromiumElement, str]]: ...
|
||||
|
||||
def befores(self, filter_loc: Union[tuple, str] = '', timeout: float = None,
|
||||
def befores(self,
|
||||
filter_loc: Union[tuple, str] = '',
|
||||
timeout: float = None,
|
||||
ele_only: bool = True) -> List[Union[ChromiumElement, str]]: ...
|
||||
|
||||
def afters(self, filter_loc: Union[tuple, str] = '', timeout: float = None,
|
||||
def afters(self,
|
||||
filter_loc: Union[tuple, str] = '',
|
||||
timeout: float = None,
|
||||
ele_only: bool = True) -> List[Union[ChromiumElement, str]]: ...
|
||||
|
||||
def get_screenshot(self, path: [str, Path] = None, name: str = None, as_bytes: [bool, str] = None,
|
||||
def get_screenshot(self,
|
||||
path: [str, Path] = None,
|
||||
name: str = None,
|
||||
as_bytes: [bool, str] = None,
|
||||
as_base64: [bool, str] = None) -> Union[str, bytes]: ...
|
||||
|
||||
def _get_screenshot(self, path: [str, Path] = None, name: str = None, as_bytes: [bool, str] = None,
|
||||
as_base64: [bool, str] = None, full_page: bool = False, left_top: Tuple[int, int] = None,
|
||||
right_bottom: Tuple[int, int] = None, ele: ChromiumElement = None) -> Union[str, bytes]: ...
|
||||
def _get_screenshot(self,
|
||||
path: [str, Path] = None,
|
||||
name: str = None,
|
||||
as_bytes: [bool, str] = None,
|
||||
as_base64: [bool, str] = None,
|
||||
full_page: bool = False,
|
||||
left_top: Tuple[int, int] = None,
|
||||
right_bottom: Tuple[int, int] = None,
|
||||
ele: ChromiumElement = None) -> Union[str, bytes]: ...
|
||||
|
||||
def _find_elements(self, loc_or_ele: Union[Tuple[str, str], str, ChromiumElement, ChromiumFrame],
|
||||
timeout: float = None, single: bool = True, relative: bool = False, raise_err: bool = None) \
|
||||
def _find_elements(self,
|
||||
loc_or_ele: Union[Tuple[str, str], str, ChromiumElement, ChromiumFrame],
|
||||
timeout: float = None,
|
||||
single: bool = True,
|
||||
relative: bool = False,
|
||||
raise_err: bool = None) \
|
||||
-> Union[ChromiumElement, ChromiumFrame, None, List[Union[ChromiumElement, ChromiumFrame]]]: ...
|
||||
|
||||
def _is_inner_frame(self) -> bool: ...
|
||||
|
@ -14,6 +14,7 @@ from .session_page import SessionPage
|
||||
from .web_page import WebPage
|
||||
from .._base.browser import Browser
|
||||
from .._elements.chromium_element import ChromiumElement
|
||||
from .._elements.none_element import NoneElement
|
||||
from .._elements.session_element import SessionElement
|
||||
from .._units.rect import TabRect
|
||||
from .._units.setter import TabSetter, WebPageTabSetter
|
||||
@ -51,7 +52,7 @@ class WebPageTab(SessionPage, ChromiumTab):
|
||||
|
||||
def __call__(self,
|
||||
loc_or_str: Union[Tuple[str, str], str, ChromiumElement, SessionElement],
|
||||
timeout: float = None) -> Union[ChromiumElement, SessionElement]: ...
|
||||
timeout: float = None) -> Union[ChromiumElement, SessionElement, NoneElement]: ...
|
||||
|
||||
@property
|
||||
def page(self) -> WebPage: ...
|
||||
@ -120,16 +121,16 @@ class WebPageTab(SessionPage, ChromiumTab):
|
||||
|
||||
def ele(self,
|
||||
loc_or_ele: Union[Tuple[str, str], str, ChromiumElement, SessionElement],
|
||||
timeout: float = None) -> Union[ChromiumElement, SessionElement, str]: ...
|
||||
timeout: float = None) -> Union[ChromiumElement, SessionElement, NoneElement]: ...
|
||||
|
||||
def eles(self,
|
||||
loc_or_str: Union[Tuple[str, str], str],
|
||||
timeout: float = None) -> List[Union[ChromiumElement, SessionElement, str]]: ...
|
||||
timeout: float = None) -> List[Union[ChromiumElement, SessionElement]]: ...
|
||||
|
||||
def s_ele(self, loc_or_ele: Union[Tuple[str, str], str] = None) \
|
||||
-> Union[SessionElement, str, None]: ...
|
||||
-> Union[SessionElement, NoneElement]: ...
|
||||
|
||||
def s_eles(self, loc_or_str: Union[Tuple[str, str], str]) -> List[Union[SessionElement, str]]: ...
|
||||
def s_eles(self, loc_or_str: Union[Tuple[str, str], str]) -> List[SessionElement]: ...
|
||||
|
||||
def change_mode(self, mode: str = None, go: bool = True, copy_cookies: bool = True) -> None: ...
|
||||
|
||||
@ -168,5 +169,5 @@ class WebPageTab(SessionPage, ChromiumTab):
|
||||
|
||||
def _find_elements(self, loc_or_ele: Union[Tuple[str, str], str, ChromiumElement, SessionElement, ChromiumFrame],
|
||||
timeout: float = None, single: bool = True, relative: bool = False, raise_err: bool = None) \
|
||||
-> Union[ChromiumElement, SessionElement, ChromiumFrame, str, None, List[Union[SessionElement, str]], List[
|
||||
Union[ChromiumElement, str, ChromiumFrame]]]: ...
|
||||
-> Union[ChromiumElement, SessionElement, ChromiumFrame, NoneElement, List[SessionElement], List[
|
||||
Union[ChromiumElement, ChromiumFrame]]]: ...
|
||||
|
@ -40,7 +40,7 @@ class SessionPage(BasePage):
|
||||
|
||||
def __call__(self,
|
||||
loc_or_str: Union[Tuple[str, str], str, SessionElement],
|
||||
timeout: float = None) -> Union[SessionElement, str, NoneElement]: ...
|
||||
timeout: float = None) -> Union[SessionElement, NoneElement]: ...
|
||||
|
||||
# -----------------共有属性和方法-------------------
|
||||
@property
|
||||
@ -89,23 +89,28 @@ class SessionPage(BasePage):
|
||||
|
||||
def ele(self,
|
||||
loc_or_ele: Union[Tuple[str, str], str, SessionElement],
|
||||
timeout: float = None) -> Union[SessionElement, str, NoneElement]: ...
|
||||
timeout: float = None) -> Union[SessionElement, NoneElement]: ...
|
||||
|
||||
def eles(self,
|
||||
loc_or_str: Union[Tuple[str, str], str],
|
||||
timeout: float = None) -> List[Union[SessionElement, str]]: ...
|
||||
timeout: float = None) -> List[SessionElement]: ...
|
||||
|
||||
def s_ele(self,
|
||||
loc_or_ele: Union[Tuple[str, str], str, SessionElement] = None) \
|
||||
-> Union[SessionElement, str, NoneElement]: ...
|
||||
-> Union[SessionElement, NoneElement]: ...
|
||||
|
||||
def s_eles(self, loc_or_str: Union[Tuple[str, str], str]) -> List[Union[SessionElement, str]]: ...
|
||||
def s_eles(self, loc_or_str: Union[Tuple[str, str], str]) -> List[SessionElement]: ...
|
||||
|
||||
def _find_elements(self, loc_or_ele: Union[Tuple[str, str], str, SessionElement],
|
||||
timeout: float = None, single: bool = True, raise_err: bool = None) \
|
||||
-> Union[SessionElement, str, NoneElement, List[Union[SessionElement, str]]]: ...
|
||||
def _find_elements(self,
|
||||
loc_or_ele: Union[Tuple[str, str], str, SessionElement],
|
||||
timeout: float = None,
|
||||
single: bool = True,
|
||||
raise_err: bool = None) \
|
||||
-> Union[SessionElement, NoneElement, List[SessionElement]]: ...
|
||||
|
||||
def get_cookies(self, as_dict: bool = False, all_domains: bool = False,
|
||||
def get_cookies(self,
|
||||
as_dict: bool = False,
|
||||
all_domains: bool = False,
|
||||
all_info: bool = False) -> Union[dict, list]: ...
|
||||
|
||||
# ----------------session独有属性和方法-----------------------
|
||||
@ -164,7 +169,8 @@ class SessionPage(BasePage):
|
||||
**kwargs) -> tuple: ...
|
||||
|
||||
|
||||
def check_headers(kwargs: Union[dict, CaseInsensitiveDict], headers: Union[dict, CaseInsensitiveDict],
|
||||
def check_headers(kwargs: Union[dict, CaseInsensitiveDict],
|
||||
headers: Union[dict, CaseInsensitiveDict],
|
||||
arg: str) -> bool: ...
|
||||
|
||||
|
||||
|
@ -16,6 +16,7 @@ from .._base.driver import Driver
|
||||
from .._configs.chromium_options import ChromiumOptions
|
||||
from .._configs.session_options import SessionOptions
|
||||
from .._elements.chromium_element import ChromiumElement
|
||||
from .._elements.none_element import NoneElement
|
||||
from .._elements.session_element import SessionElement
|
||||
from .._units.setter import WebPageSetter
|
||||
|
||||
@ -35,7 +36,7 @@ class WebPage(SessionPage, ChromiumPage, BasePage):
|
||||
|
||||
def __call__(self,
|
||||
loc_or_str: Union[Tuple[str, str], str, ChromiumElement, SessionElement],
|
||||
timeout: float = None) -> Union[ChromiumElement, SessionElement]: ...
|
||||
timeout: float = None) -> Union[ChromiumElement, SessionElement, NoneElement]: ...
|
||||
|
||||
# -----------------共有属性和方法-------------------
|
||||
@property
|
||||
@ -102,16 +103,15 @@ class WebPage(SessionPage, ChromiumPage, BasePage):
|
||||
|
||||
def ele(self,
|
||||
loc_or_ele: Union[Tuple[str, str], str, ChromiumElement, SessionElement],
|
||||
timeout: float = None) -> Union[ChromiumElement, SessionElement, str]: ...
|
||||
timeout: float = None) -> Union[ChromiumElement, SessionElement, NoneElement]: ...
|
||||
|
||||
def eles(self,
|
||||
loc_or_str: Union[Tuple[str, str], str],
|
||||
timeout: float = None) -> List[Union[ChromiumElement, SessionElement, str]]: ...
|
||||
timeout: float = None) -> List[Union[ChromiumElement, SessionElement]]: ...
|
||||
|
||||
def s_ele(self, loc_or_ele: Union[Tuple[str, str], str] = None) \
|
||||
-> Union[SessionElement, str, None]: ...
|
||||
def s_ele(self, loc_or_ele: Union[Tuple[str, str], str] = None) -> Union[SessionElement, NoneElement]: ...
|
||||
|
||||
def s_eles(self, loc_or_str: Union[Tuple[str, str], str]) -> List[Union[SessionElement, str]]: ...
|
||||
def s_eles(self, loc_or_str: Union[Tuple[str, str], str]) -> List[SessionElement]: ...
|
||||
|
||||
def change_mode(self, mode: str = None, go: bool = True, copy_cookies: bool = True) -> None: ...
|
||||
|
||||
@ -119,12 +119,17 @@ class WebPage(SessionPage, ChromiumPage, BasePage):
|
||||
|
||||
def cookies_to_browser(self) -> None: ...
|
||||
|
||||
def get_cookies(self, as_dict: bool = False, all_domains: bool = False,
|
||||
def get_cookies(self,
|
||||
as_dict: bool = False,
|
||||
all_domains: bool = False,
|
||||
all_info: bool = False) -> Union[dict, list]: ...
|
||||
|
||||
def get_tab(self, id_or_num: Union[str, WebPageTab, int] = None) -> WebPageTab: ...
|
||||
|
||||
def new_tab(self, url: str = None, new_window: bool = False, background: bool = False,
|
||||
def new_tab(self,
|
||||
url: str = None,
|
||||
new_window: bool = False,
|
||||
background: bool = False,
|
||||
new_context: bool = False) -> WebPageTab: ...
|
||||
|
||||
def close_driver(self) -> None: ...
|
||||
@ -157,12 +162,17 @@ class WebPage(SessionPage, ChromiumPage, BasePage):
|
||||
@property
|
||||
def set(self) -> WebPageSetter: ...
|
||||
|
||||
def _find_elements(self, loc_or_ele: Union[Tuple[str, str], str, ChromiumElement, SessionElement, ChromiumFrame],
|
||||
timeout: float = None, single: bool = True, relative: bool = False, raise_err: bool = None) \
|
||||
-> Union[ChromiumElement, SessionElement, ChromiumFrame, str, None, List[Union[SessionElement, str]], List[
|
||||
Union[ChromiumElement, str, ChromiumFrame]]]: ...
|
||||
def _find_elements(self,
|
||||
loc_or_ele: Union[Tuple[str, str], str, ChromiumElement, SessionElement, ChromiumFrame],
|
||||
timeout: float = None,
|
||||
single: bool = True,
|
||||
relative: bool = False,
|
||||
raise_err: bool = None) \
|
||||
-> Union[ChromiumElement, SessionElement, ChromiumFrame, NoneElement, List[SessionElement],
|
||||
List[Union[ChromiumElement, ChromiumFrame]]]: ...
|
||||
|
||||
def _set_start_options(self, dr_opt: Union[Driver, bool, None],
|
||||
def _set_start_options(self,
|
||||
dr_opt: Union[Driver, bool, None],
|
||||
se_opt: Union[Session, SessionOptions, bool, None]) -> None: ...
|
||||
|
||||
def quit(self, timeout: float = 5, force: bool = True) -> None: ...
|
||||
|
Loading…
x
Reference in New Issue
Block a user