调整注释

This commit is contained in:
g1879 2020-12-04 17:16:18 +08:00
parent 0a5315b93a
commit b9365a9361
6 changed files with 15 additions and 14 deletions

View File

@ -140,7 +140,7 @@ class DriverElement(DrissionElement):
return self.get_style_property('content', 'after')
# -----------------共有函数-------------------
def texts(self, text_node_only: bool = False) -> List[str]:
def texts(self, text_node_only: bool = False) -> list:
"""返回元素内所有直接子节点的文本,包括元素和文本节点 \n
:param text_node_only: 是否只返回文本节点
:return: 文本列表
@ -567,7 +567,7 @@ class DriverElement(DrissionElement):
def execute_driver_find(page_or_ele,
loc: Tuple[str, str],
mode: str = 'single',
timeout: float = 10) -> Union[DriverElement, List[DriverElement or str], str, None]:
timeout: float = 10) -> Union[DriverElement, List[DriverElement], str, None]:
"""执行driver模式元素的查找 \n
页面查找元素及元素查找下级元素皆使用此方法 \n
:param page_or_ele: DriverPage对象或DriverElement对象

View File

@ -336,7 +336,8 @@ class MixPage(Null, SessionPage, DriverPage):
def ele(self,
loc_or_ele: Union[Tuple[str, str], str, DriverElement, SessionElement, WebElement],
mode: str = None,
timeout: float = None) -> Union[DriverElement, SessionElement, str]:
timeout: float = None) -> Union[
DriverElement, SessionElement, str, List[SessionElement], List[DriverElement]]:
"""返回页面中符合条件的元素、属性或节点文本,默认返回第一个 \n
示例 \n
- 接收到元素对象时 \n
@ -376,7 +377,7 @@ class MixPage(Null, SessionPage, DriverPage):
def eles(self,
loc_or_str: Union[Tuple[str, str], str],
timeout: float = None) -> Union[List[DriverElement or str], List[SessionElement or str]]:
timeout: float = None) -> Union[List[DriverElement], List[SessionElement]]:
"""返回页面中所有符合条件的元素、属性或节点文本 \n
示例 \n
- 用loc元组查找 \n

View File

@ -92,7 +92,7 @@ class SessionElement(DrissionElement):
"""返回前一个兄弟元素"""
return self._get_brother(1, 'ele', 'prev')
def texts(self, text_node_only: bool = False) -> List[str]:
def texts(self, text_node_only: bool = False) -> list:
"""返回元素内所有直接子节点的文本,包括元素和文本节点 \n
:param text_node_only: 是否只返回文本节点
:return: 文本列表
@ -340,7 +340,7 @@ class SessionElement(DrissionElement):
def execute_session_find(page_or_ele,
loc: Tuple[str, str],
mode: str = 'single', ) -> Union[SessionElement, List[SessionElement or str], str, None]:
mode: str = 'single', ) -> Union[SessionElement, List[SessionElement], str, None]:
"""执行session模式元素的查找 \n
页面查找元素及元素查找下级元素皆使用此方法 \n
:param page_or_ele: SessionPage对象或SessionElement对象

View File

@ -88,7 +88,7 @@ class SessionPage(object):
def ele(self,
loc_or_ele: Union[Tuple[str, str], str, SessionElement],
mode: str = None) -> Union[SessionElement, List[SessionElement or str], str, None]:
mode: str = None) -> Union[SessionElement, List[SessionElement], str, None]:
"""返回页面中符合条件的元素、属性或节点文本,默认返回第一个 \n
示例 \n
- 接收到元素对象时 \n
@ -140,7 +140,7 @@ class SessionPage(object):
return execute_session_find(self, loc_or_ele, mode)
def eles(self,
loc_or_str: Union[Tuple[str, str], str]) -> List[SessionElement or str]:
loc_or_str: Union[Tuple[str, str], str]) -> List[SessionElement]:
"""返回页面中所有符合条件的元素、属性或节点文本 \n
示例 \n
- 用loc元组查找 \n

View File

@ -568,7 +568,7 @@ page.run_script(js, *args) # Run js statement
page.create_tab(url) # Create and locate a tab page, which is at the end
page.to_tab(num_or_handle) # Jump to tab page
page.close_current_tab() # Close the current tab page
page.close_other_tabs(num) # Close other tabs
page.close_other_tabs(num_or_handles) # Close other tabs
page.to_iframe(iframe) # cut into iframe
page.screenshot(path) # Page screenshot
page.scrool_to_see(element) # Scroll until an element is visible
@ -1669,11 +1669,11 @@ Returns: None
### close_other_tabs()
Close tab pages other than the incoming tab page, and keep the current page by default.
Close tab pages other than the incoming tab page, and keep the current page by default. You can pass in a list or tuple.
Parameter Description:
- num_or_handle:[int, str] - The serial number or handle of the tab to keep, the first serial number is 0, and the last is - 1
- num_or_handles:[int, str]-The serial number or handle of the tab to keep, you can pass in a list or tuple of handles
Returns: None

View File

@ -572,7 +572,7 @@ page.run_script(js, *args) # 运行 js 语句
page.create_tab(url) # 新建并定位到一个标签页,该标签页在最后面
page.to_tab(num_or_handle) # 跳转到标签页
page.close_current_tab() # 关闭当前标签页
page.close_other_tabs(num) # 关闭其它标签页
page.close_other_tabs(num_or_handles) # 关闭其它标签页
page.to_iframe(iframe) # 切入 iframe
page.screenshot(path) # 页面截图
page.scroll_to_see(element) # 滚动直到某元素可见
@ -1669,11 +1669,11 @@ d 模式时检查网页是否符合预期。默认由 response 状态检查,
### close_other_tabs()
关闭传入的标签页以外标签页,默认保留当前页。
关闭传入的标签页以外标签页,默认保留当前页。可传入列表或元组。
参数说明:
- num_or_handle:[int, str] - 要保留的标签页序号或 handle序号第一个为0最后为-1
- num_or_handles:[int, str] - 要保留的标签页序号或 handle可传入 handle 组成的列表或元组
返回: None