diff --git a/DrissionPage/base.py b/DrissionPage/base.py index 78ad5ca..5090b60 100644 --- a/DrissionPage/base.py +++ b/DrissionPage/base.py @@ -30,7 +30,7 @@ class BaseParser(object): return @abstractmethod - def ele(self, loc_or_ele, mode, timeout): + def ele(self, loc_or_ele, mode='single', timeout=None): pass @@ -75,7 +75,7 @@ class BaseElement(BaseParser): return True @abstractmethod - def ele(self, loc_or_str, mode, timeout): + def ele(self, loc_or_str, mode='single', timeout=None): pass @abstractmethod @@ -228,7 +228,7 @@ class BasePage(BaseParser): @property def title(self) -> Union[str, None]: """返回网页title""" - ele = self('x:/html/head/title') + ele = self.ele('x:/html/head/title') return ele.text if ele else None @property @@ -281,7 +281,7 @@ class BasePage(BaseParser): pass @abstractmethod - def ele(self, loc_or_ele, mode, timeout): + def ele(self, loc_or_ele, mode='single', timeout=None): pass @abstractmethod diff --git a/DrissionPage/driver_page.py b/DrissionPage/driver_page.py index 7a7e6e8..fde34e2 100644 --- a/DrissionPage/driver_page.py +++ b/DrissionPage/driver_page.py @@ -318,7 +318,7 @@ class DriverPage(BasePage): def to_frame(self, loc_or_ele: Union[int, str, tuple, WebElement, DriverElement] = 'main') -> None: """跳转到frame \n 可接收frame序号(0开始)、id或name、查询字符串、loc元组、WebElement对象、DriverElement对象, \n - 传入'main'跳到最高层,传入'parent'跳到上一层 \n + 传入 'main' 跳到最高层,传入 'parent' 跳到上一层 \n 示例: \n to_frame('tag:iframe') - 通过传入frame的查询字符串定位 \n to_frame('iframe_id') - 通过frame的id属性定位 \n