From 5fa71a7f0aa14a6aa28941dcf040a6272197c323 Mon Sep 17 00:00:00 2001 From: g1879 Date: Tue, 21 Nov 2023 18:00:15 +0800 Subject: [PATCH] =?UTF-8?q?click.twice()=E6=94=B9=E4=B8=BAclick.multiple()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DrissionPage/_units/clicker.py | 15 ++++++++++++--- DrissionPage/_units/clicker.pyi | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/DrissionPage/_units/clicker.py b/DrissionPage/_units/clicker.py index 2f8d425..c103004 100644 --- a/DrissionPage/_units/clicker.py +++ b/DrissionPage/_units/clicker.py @@ -124,9 +124,12 @@ class Clicker(object): x, y = offset_scroll(self._ele, offset_x, offset_y) self._click(x, y, button, count) - def twice(self): - """双击元素""" - self.at(count=2) + def multiple(self, times=2): + """多次点击 + :param times: 默认双击 + :return: None + """ + self.at(count=times) def _click(self, client_x, client_y, button='left', count=1): """实施点击 @@ -141,3 +144,9 @@ class Clicker(object): # sleep(.05) self._ele.page.run_cdp('Input.dispatchMouseEvent', type='mouseReleased', x=client_x, y=client_y, button=button) + + # -------------即将废弃-------------- + + def twice(self): + """双击元素""" + self.at(count=2) diff --git a/DrissionPage/_units/clicker.pyi b/DrissionPage/_units/clicker.pyi index 4866ff5..d62b99f 100644 --- a/DrissionPage/_units/clicker.pyi +++ b/DrissionPage/_units/clicker.pyi @@ -22,6 +22,6 @@ class Clicker(object): def at(self, offset_x: float = None, offset_y: float = None, button: str = 'left', count: int = 1) -> None: ... - def twice(self, by_js: bool = False) -> None: ... + def multiple(self, times: int = 2) -> None: ... def _click(self, client_x: float, client_y: float, button: str = 'left', count: int = 1) -> None: ...