mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
增加__call__()方法,等效于ele()
This commit is contained in:
parent
ba245d4b47
commit
d0467241b4
@ -66,6 +66,12 @@ class MixPage(Null, SessionPage, DriverPage):
|
|||||||
else:
|
else:
|
||||||
raise ValueError("Argument mode can only be 'd' or 's'.")
|
raise ValueError("Argument mode can only be 'd' or 's'.")
|
||||||
|
|
||||||
|
def __call__(self,
|
||||||
|
loc_or_str: Union[Tuple[str, str], str, DriverElement, SessionElement, WebElement],
|
||||||
|
mode: str = 'single',
|
||||||
|
timeout: float = None):
|
||||||
|
return self.ele(loc_or_str, mode, timeout or self.timeout)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def url(self) -> Union[str, None]:
|
def url(self) -> Union[str, None]:
|
||||||
"""返回当前url"""
|
"""返回当前url"""
|
||||||
@ -130,9 +136,7 @@ class MixPage(Null, SessionPage, DriverPage):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def session(self) -> Session:
|
def session(self) -> Session:
|
||||||
"""返回session对象,如没有则创建 \n
|
"""返回Session对象,如没有则创建"""
|
||||||
:return: Session对象
|
|
||||||
"""
|
|
||||||
return self._drission.session
|
return self._drission.session
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -161,8 +165,8 @@ class MixPage(Null, SessionPage, DriverPage):
|
|||||||
:param url: 目标域
|
:param url: 目标域
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
u = url or self._session_url
|
url = url or self._session_url
|
||||||
self._drission.cookies_to_driver(u)
|
self._drission.cookies_to_driver(url)
|
||||||
|
|
||||||
def check_page(self, by_requests: bool = False) -> Union[bool, None]:
|
def check_page(self, by_requests: bool = False) -> Union[bool, None]:
|
||||||
"""d模式时检查网页是否符合预期 \n
|
"""d模式时检查网页是否符合预期 \n
|
||||||
|
Loading…
x
Reference in New Issue
Block a user