From f60f91b85d869746ec732fab55af8dc902376ed3 Mon Sep 17 00:00:00 2001 From: g1879 Date: Mon, 27 Mar 2023 14:46:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=83=E7=B4=A0states=E5=A2=9E=E5=8A=A0is=5F?= =?UTF-8?q?checked?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DrissionPage/chromium_base.py | 10 +++++++++- DrissionPage/chromium_base.pyi | 5 ++++- DrissionPage/chromium_element.py | 5 +++++ DrissionPage/chromium_element.pyi | 3 +++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/DrissionPage/chromium_base.py b/DrissionPage/chromium_base.py index c326e94..8719d4a 100644 --- a/DrissionPage/chromium_base.py +++ b/DrissionPage/chromium_base.py @@ -369,7 +369,7 @@ class ChromiumBase(BasePage): if error == 'Cannot find context with specified id': raise ContextLossError elif error in ('Could not find node with given id', 'Could not find object with given id', - 'No node with given id found'): + 'No node with given id found', 'Node with given id does not belong to the document'): raise ElementLossError elif error == 'tab closed': raise TabClosedError @@ -1061,6 +1061,14 @@ class ChromiumBaseWaiter(object): """ return self._loading(timeout=timeout, start=False) + def data_package(self, target, timeout=None): + """ + :param target: + :param timeout: + :return: + """ + pass + def upload_paths_inputted(self): """等待自动填写上传文件路径""" while self._driver._upload_list: diff --git a/DrissionPage/chromium_base.pyi b/DrissionPage/chromium_base.pyi index de26cd9..39b2792 100644 --- a/DrissionPage/chromium_base.pyi +++ b/DrissionPage/chromium_base.pyi @@ -7,14 +7,15 @@ from pathlib import Path from typing import Union, Tuple, List, Any from DataRecorder import Recorder +from FlowViewer.listener import ResponseData from requests import Session from requests.cookies import RequestsCookieJar -from .commons.constants import NoneElement from .base import BasePage from .chromium_driver import ChromiumDriver from .chromium_element import ChromiumElement, ChromiumScroll from .chromium_frame import ChromiumFrame +from .commons.constants import NoneElement from .session_element import SessionElement @@ -229,6 +230,8 @@ class ChromiumBaseWaiter(object): def load_complete(self, timeout: float = None) -> bool: ... + def data_package(self, target, timeout: float = None) -> Union[ResponseData, None]: ... + def upload_paths_inputted(self) -> None: ... diff --git a/DrissionPage/chromium_element.py b/DrissionPage/chromium_element.py index 244c8bb..7ae2846 100644 --- a/DrissionPage/chromium_element.py +++ b/DrissionPage/chromium_element.py @@ -1534,6 +1534,11 @@ class ChromiumElementStates(object): """返回元素是否被选择""" return self._ele.run_js('return this.selected;') + @property + def is_checked(self): + """返回元素是否被选择""" + return self._ele.run_js('return this.checked;') + @property def is_displayed(self): """返回元素是否显示""" diff --git a/DrissionPage/chromium_element.pyi b/DrissionPage/chromium_element.pyi index 8d44fb4..84be5f5 100644 --- a/DrissionPage/chromium_element.pyi +++ b/DrissionPage/chromium_element.pyi @@ -213,6 +213,9 @@ class ChromiumElementStates(object): @property def is_selected(self) -> bool: ... + @property + def is_checked(self) -> bool: ... + @property def is_displayed(self) -> bool: ...