mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
微调
This commit is contained in:
parent
a4f4f32760
commit
b64db1c43d
@ -211,12 +211,11 @@ class ChromiumElement(DrissionElement):
|
|||||||
def click(self, by_js: bool = None, retry: bool = False, timeout: float = 0.2,
|
def click(self, by_js: bool = None, retry: bool = False, timeout: float = 0.2,
|
||||||
wait_loading: Union[bool, float] = 0) -> bool: ...
|
wait_loading: Union[bool, float] = 0) -> bool: ...
|
||||||
|
|
||||||
def click_at(self, offset_x: Union[int, str] = None, offset_y: Union[int, str] = None,
|
def click_at(self, offset_x: int = None, offset_y: int = None, button: str = 'left') -> None: ...
|
||||||
button: str = 'left') -> None: ...
|
|
||||||
|
|
||||||
def r_click(self) -> None: ...
|
def r_click(self) -> None: ...
|
||||||
|
|
||||||
def r_click_at(self, offset_x: Union[int, str] = None, offset_y: Union[int, str] = None) -> None: ...
|
def r_click_at(self, offset_x: int = None, offset_y: int = None) -> None: ...
|
||||||
|
|
||||||
def m_click(self) -> None: ...
|
def m_click(self) -> None: ...
|
||||||
|
|
||||||
|
@ -350,6 +350,7 @@ class ChromiumPage(ChromiumBase):
|
|||||||
:return: 提示框内容文本,未等到提示框则返回None
|
:return: 提示框内容文本,未等到提示框则返回None
|
||||||
"""
|
"""
|
||||||
timeout = timeout or self.timeout
|
timeout = timeout or self.timeout
|
||||||
|
timeout = .1 if timeout <= 0 else timeout
|
||||||
end_time = perf_counter() + timeout
|
end_time = perf_counter() + timeout
|
||||||
while not self._alert.activated and perf_counter() < end_time:
|
while not self._alert.activated and perf_counter() < end_time:
|
||||||
sleep(.1)
|
sleep(.1)
|
||||||
|
@ -81,7 +81,7 @@ class SessionElement(DrissionElement):
|
|||||||
"""
|
"""
|
||||||
return super().parent(level_or_loc)
|
return super().parent(level_or_loc)
|
||||||
|
|
||||||
def prev(self, filter_loc='', index=1, timeout=0):
|
def prev(self, filter_loc='', index=1, timeout=None):
|
||||||
"""返回前面的一个兄弟元素,可用查询语法筛选,可指定返回筛选结果的第几个
|
"""返回前面的一个兄弟元素,可用查询语法筛选,可指定返回筛选结果的第几个
|
||||||
:param filter_loc: 用于筛选元素的查询语法
|
:param filter_loc: 用于筛选元素的查询语法
|
||||||
:param index: 前面第几个查询结果元素
|
:param index: 前面第几个查询结果元素
|
||||||
@ -90,7 +90,7 @@ class SessionElement(DrissionElement):
|
|||||||
"""
|
"""
|
||||||
return super().prev(index, filter_loc, timeout)
|
return super().prev(index, filter_loc, timeout)
|
||||||
|
|
||||||
def next(self, filter_loc='', index=1, timeout=0):
|
def next(self, filter_loc='', index=1, timeout=None):
|
||||||
"""返回后面的一个兄弟元素,可用查询语法筛选,可指定返回筛选结果的第几个
|
"""返回后面的一个兄弟元素,可用查询语法筛选,可指定返回筛选结果的第几个
|
||||||
:param filter_loc: 用于筛选元素的查询语法
|
:param filter_loc: 用于筛选元素的查询语法
|
||||||
:param index: 后面第几个查询结果元素
|
:param index: 后面第几个查询结果元素
|
||||||
@ -117,7 +117,7 @@ class SessionElement(DrissionElement):
|
|||||||
"""
|
"""
|
||||||
return super().after(index, filter_loc, timeout)
|
return super().after(index, filter_loc, timeout)
|
||||||
|
|
||||||
def prevs(self, filter_loc='', timeout=0):
|
def prevs(self, filter_loc='', timeout=None):
|
||||||
"""返回前面全部兄弟元素或节点组成的列表,可用查询语法筛选
|
"""返回前面全部兄弟元素或节点组成的列表,可用查询语法筛选
|
||||||
:param filter_loc: 用于筛选元素的查询语法
|
:param filter_loc: 用于筛选元素的查询语法
|
||||||
:param timeout: 查找元素的超时时间
|
:param timeout: 查找元素的超时时间
|
||||||
@ -125,7 +125,7 @@ class SessionElement(DrissionElement):
|
|||||||
"""
|
"""
|
||||||
return super().prevs(filter_loc, timeout)
|
return super().prevs(filter_loc, timeout)
|
||||||
|
|
||||||
def nexts(self, filter_loc='', timeout=0):
|
def nexts(self, filter_loc='', timeout=None):
|
||||||
"""返回后面全部兄弟元素或节点组成的列表,可用查询语法筛选
|
"""返回后面全部兄弟元素或节点组成的列表,可用查询语法筛选
|
||||||
:param filter_loc: 用于筛选元素的查询语法
|
:param filter_loc: 用于筛选元素的查询语法
|
||||||
:param timeout: 查找元素的超时时间
|
:param timeout: 查找元素的超时时间
|
||||||
|
@ -54,12 +54,12 @@ class SessionElement(DrissionElement):
|
|||||||
def prev(self,
|
def prev(self,
|
||||||
filter_loc: Union[tuple, str] = '',
|
filter_loc: Union[tuple, str] = '',
|
||||||
index: int = 1,
|
index: int = 1,
|
||||||
timeout: float = 0) -> Union['SessionElement', str, None]: ...
|
timeout: float = None) -> Union['SessionElement', str, None]: ...
|
||||||
|
|
||||||
def next(self,
|
def next(self,
|
||||||
filter_loc: Union[tuple, str] = '',
|
filter_loc: Union[tuple, str] = '',
|
||||||
index: int = 1,
|
index: int = 1,
|
||||||
timeout: float = 0) -> Union['SessionElement', str, None]: ...
|
timeout: float = None) -> Union['SessionElement', str, None]: ...
|
||||||
|
|
||||||
def before(self,
|
def before(self,
|
||||||
filter_loc: Union[tuple, str] = '',
|
filter_loc: Union[tuple, str] = '',
|
||||||
@ -73,11 +73,11 @@ class SessionElement(DrissionElement):
|
|||||||
|
|
||||||
def prevs(self,
|
def prevs(self,
|
||||||
filter_loc: Union[tuple, str] = '',
|
filter_loc: Union[tuple, str] = '',
|
||||||
timeout: float = 0) -> List[Union['SessionElement', str]]: ...
|
timeout: float = None) -> List[Union['SessionElement', str]]: ...
|
||||||
|
|
||||||
def nexts(self,
|
def nexts(self,
|
||||||
filter_loc: Union[tuple, str] = '',
|
filter_loc: Union[tuple, str] = '',
|
||||||
timeout: float = 0) -> List[Union['SessionElement', str]]: ...
|
timeout: float = None) -> List[Union['SessionElement', str]]: ...
|
||||||
|
|
||||||
def befores(self,
|
def befores(self,
|
||||||
filter_loc: Union[tuple, str] = '',
|
filter_loc: Union[tuple, str] = '',
|
||||||
|
@ -94,7 +94,7 @@ class SessionPage(BasePage):
|
|||||||
"""在内部查找元素
|
"""在内部查找元素
|
||||||
例:ele2 = ele1('@id=ele_id')
|
例:ele2 = ele1('@id=ele_id')
|
||||||
:param loc_or_str: 元素的定位信息,可以是loc元组,或查询字符串
|
:param loc_or_str: 元素的定位信息,可以是loc元组,或查询字符串
|
||||||
:param timeout: 不起实际作用,用于和DriverElement对应,便于无差别调用
|
:param timeout: 不起实际作用,用于和ChromiumElement对应,便于无差别调用
|
||||||
:return: SessionElement对象或属性文本
|
:return: SessionElement对象或属性文本
|
||||||
"""
|
"""
|
||||||
return self.ele(loc_or_str)
|
return self.ele(loc_or_str)
|
||||||
@ -160,7 +160,7 @@ class SessionPage(BasePage):
|
|||||||
def ele(self, loc_or_ele, timeout=None):
|
def ele(self, loc_or_ele, timeout=None):
|
||||||
"""返回页面中符合条件的第一个元素、属性或节点文本
|
"""返回页面中符合条件的第一个元素、属性或节点文本
|
||||||
:param loc_or_ele: 元素的定位信息,可以是元素对象,loc元组,或查询字符串
|
:param loc_or_ele: 元素的定位信息,可以是元素对象,loc元组,或查询字符串
|
||||||
:param timeout: 不起实际作用,用于和DriverElement对应,便于无差别调用
|
:param timeout: 不起实际作用,用于和ChromiumElement对应,便于无差别调用
|
||||||
:return: SessionElement对象或属性、文本
|
:return: SessionElement对象或属性、文本
|
||||||
"""
|
"""
|
||||||
return self._ele(loc_or_ele)
|
return self._ele(loc_or_ele)
|
||||||
@ -168,7 +168,7 @@ class SessionPage(BasePage):
|
|||||||
def eles(self, loc_or_str, timeout=None):
|
def eles(self, loc_or_str, timeout=None):
|
||||||
"""返回页面中所有符合条件的元素、属性或节点文本
|
"""返回页面中所有符合条件的元素、属性或节点文本
|
||||||
:param loc_or_str: 元素的定位信息,可以是loc元组,或查询字符串
|
:param loc_or_str: 元素的定位信息,可以是loc元组,或查询字符串
|
||||||
:param timeout: 不起实际作用,用于和DriverElement对应,便于无差别调用
|
:param timeout: 不起实际作用,用于和ChromiumElement对应,便于无差别调用
|
||||||
:return: SessionElement对象或属性、文本组成的列表
|
:return: SessionElement对象或属性、文本组成的列表
|
||||||
"""
|
"""
|
||||||
return self._ele(loc_or_str, single=False)
|
return self._ele(loc_or_str, single=False)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user