From b932ab73900bbeb1e0d2f292525e993a47018343 Mon Sep 17 00:00:00 2001 From: g1879 Date: Tue, 14 Mar 2023 19:08:37 +0800 Subject: [PATCH] =?UTF-8?q?3.2.19click()=E5=BC=BA=E5=88=B6=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E6=97=B6=E5=A6=82=E5=85=83=E7=B4=A0=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E5=88=B0=E8=A7=86=E5=8F=A3=EF=BC=8C=E6=94=B9?= =?UTF-8?q?=E7=94=A8js=EF=BC=9Bclick()=E5=A2=9E=E5=8A=A0timeout=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DrissionPage/chromium_element.py | 10 +++++++--- setup.py | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/DrissionPage/chromium_element.py b/DrissionPage/chromium_element.py index 5cb0717..e717c75 100644 --- a/DrissionPage/chromium_element.py +++ b/DrissionPage/chromium_element.py @@ -1662,11 +1662,15 @@ class Click(object): can_click = False timeout = self._ele.page.timeout if timeout is None else timeout - end_time = perf_counter() + timeout - while perf_counter() < end_time: + if timeout == 0: if self._ele.states.is_in_viewport and self._ele.states.is_enabled and self._ele.states.is_displayed: can_click = True - break + else: + end_time = perf_counter() + timeout + while perf_counter() < end_time or timeout == 0: + if self._ele.states.is_in_viewport and self._ele.states.is_enabled and self._ele.states.is_displayed: + can_click = True + break if not self._ele.states.is_in_viewport: by_js = True diff --git a/setup.py b/setup.py index 2a108c8..2518924 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ with open("README.md", "r", encoding='utf-8') as fh: setup( name="DrissionPage", - version="3.2.18", + version="3.2.19", author="g1879", author_email="g1879@qq.com", description="Python based web automation tool. It can control the browser and send and receive data packets.",