diff --git a/DrissionPage/chromium_base.py b/DrissionPage/chromium_base.py index 2768743..9badf6b 100644 --- a/DrissionPage/chromium_base.py +++ b/DrissionPage/chromium_base.py @@ -270,10 +270,10 @@ class ChromiumBase(BasePage): @property def ready_state(self): - """返回当前页面加载状态,'loading' 'interactive' 'complete'""" + """返回当前页面加载状态,'loading' 'interactive' 'complete',有弹出框时返回None""" try: return self.run_cdp('Runtime.evaluate', expression='document.readyState;')['result']['value'] - except AlertExistsError: + except (AlertExistsError, TypeError): return None @property diff --git a/DrissionPage/chromium_base.pyi b/DrissionPage/chromium_base.pyi index d03da87..96b5de3 100644 --- a/DrissionPage/chromium_base.pyi +++ b/DrissionPage/chromium_base.pyi @@ -96,7 +96,7 @@ class ChromiumBase(BasePage): def tab_id(self) -> str: ... @property - def ready_state(self) -> str: ... + def ready_state(self) -> Union[str, None]: ... @property def size(self) -> Tuple[int, int]: ...