From 3eee7132d5cce6a3371644813a6d65651f105691 Mon Sep 17 00:00:00 2001 From: g1879 Date: Mon, 11 Sep 2023 17:25:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DrissionPage/action_chains.py | 17 +++++++++-------- DrissionPage/chromium_page.py | 1 + 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/DrissionPage/action_chains.py b/DrissionPage/action_chains.py index b9edcaa..d30bf3a 100644 --- a/DrissionPage/action_chains.py +++ b/DrissionPage/action_chains.py @@ -59,7 +59,7 @@ class ActionChains: cx = x + offset_x cy = y + offset_y - self._dr.Input.dispatchMouseEvent(type='mouseMoved', x=cx, y=cy, modifiers=self.modifier) + self._dr.call_method('Input.dispatchMouseEvent', type='mouseMoved', x=cx, y=cy, modifiers=self.modifier) self.curr_x = cx self.curr_y = cy return self @@ -72,7 +72,8 @@ class ActionChains: """ self.curr_x += offset_x self.curr_y += offset_y - self._dr.Input.dispatchMouseEvent(type='mouseMoved', x=self.curr_x, y=self.curr_y, modifiers=self.modifier) + self._dr.call_method('Input.dispatchMouseEvent', type='mouseMoved', x=self.curr_x, y=self.curr_y, + modifiers=self.modifier) return self def click(self, on_ele=None): @@ -170,8 +171,8 @@ class ActionChains: """ if on_ele: self.move_to(on_ele) - self._dr.Input.dispatchMouseEvent(type='mousePressed', button=button, clickCount=count, - x=self.curr_x, y=self.curr_y, modifiers=self.modifier) + self._dr.call_method('Input.dispatchMouseEvent', type='mousePressed', button=button, clickCount=count, + x=self.curr_x, y=self.curr_y, modifiers=self.modifier) return self def _release(self, button): @@ -179,8 +180,8 @@ class ActionChains: :param button: 要释放的按键 :return: self """ - self._dr.Input.dispatchMouseEvent(type='mouseReleased', button=button, clickCount=1, - x=self.curr_x, y=self.curr_y, modifiers=self.modifier) + self._dr.call_method('Input.dispatchMouseEvent', type='mouseReleased', button=button, clickCount=1, + x=self.curr_x, y=self.curr_y, modifiers=self.modifier) return self def scroll(self, delta_x=0, delta_y=0, on_ele=None): @@ -192,8 +193,8 @@ class ActionChains: """ if on_ele: self.move_to(on_ele) - self._dr.Input.dispatchMouseEvent(type='mouseWheel', x=self.curr_x, y=self.curr_y, - deltaX=delta_x, deltaY=delta_y, modifiers=self.modifier) + self._dr.call_method('Input.dispatchMouseEvent', type='mouseWheel', x=self.curr_x, y=self.curr_y, + deltaX=delta_x, deltaY=delta_y, modifiers=self.modifier) return self def up(self, pixel): diff --git a/DrissionPage/chromium_page.py b/DrissionPage/chromium_page.py index 742f05c..a9336f0 100644 --- a/DrissionPage/chromium_page.py +++ b/DrissionPage/chromium_page.py @@ -476,6 +476,7 @@ class BrowserDownloadManager(object): @property def missions(self): + """返回所有未完成的下载任务""" return self._missions def add_mission(self, mission):