Skip to content
This repository was archived by the owner on Sep 28, 2025. It is now read-only.

Commit 523eaa7

Browse files
committed
Hopefully the GH Runner will agree this time
1 parent 709b745 commit 523eaa7

4 files changed

Lines changed: 18 additions & 23 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,6 @@ cython_debug/
160160
#.idea/
161161
/.idea
162162
/.vs
163+
164+
# AI Weights
165+
*.pt

cdp_patches/input/async_input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ async def double_click(
134134

135135
press_timeout = click_timeout = timeout or self.sleep_timeout
136136
if self.emulate_behaviour and emulate_behaviour:
137-
# click_timeout = random.uniform(0.14, 0.21)
137+
click_timeout = random.uniform(0.14, 0.21)
138138
self._base.move(x=x, y=y)
139139

140140
kwargs = _mk_kwargs(pressed)

cdp_patches/input/os_base/windows.py

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -134,37 +134,29 @@ def down(self, button: Literal["left", "right", "middle"], x: int, y: int, press
134134
self.ensure_window()
135135
self.browser_window.press_mouse(button=button, pressed=pressed, coords=(int(x * self.scale_factor), int(y * self.scale_factor)))
136136

137-
def double_click(self, button: Literal["left", "right", "middle"], x: int, y: int, pressed: str = "", press_timeout: float = 0.01, click_timeout: float = 0.05) -> None:
137+
def double_click(self, button: Literal["left", "right", "middle"], x: int, y: int, pressed: str = "", press_timeout: float = 0.01, click_timeout: float = 0.15) -> None:
138138
if not pressed:
139139
pressed = button
140+
flags, click_point = _calc_flags_and_coords(pressed, [x, y])
140141

141142
self.ensure_window()
142143

143144
if button.lower() == "left":
144-
first_click = (win32defines.WM_LBUTTONDOWN, win32defines.WM_LBUTTONUP)
145-
second_click = (win32defines.WM_LBUTTONDBLCLK, win32defines.WM_LBUTTONUP)
145+
click = (win32defines.WM_LBUTTONDOWN, win32defines.WM_LBUTTONUP)
146146
elif button.lower() == "right":
147-
first_click = (win32defines.WM_RBUTTONDOWN, win32defines.WM_RBUTTONUP)
148-
second_click = (win32defines.WM_RBUTTONDBLCLK, win32defines.WM_RBUTTONUP)
147+
click = (win32defines.WM_RBUTTONDOWN, win32defines.WM_RBUTTONUP)
149148
else:
150-
first_click = (win32defines.WM_MBUTTONDOWN, win32defines.WM_MBUTTONUP)
151-
second_click = (win32defines.WM_MBUTTONDBLCLK, win32defines.WM_MBUTTONUP)
149+
click = (win32defines.WM_MBUTTONDOWN, win32defines.WM_MBUTTONUP)
152150

153151
# figure out the flags and pack coordinates
154-
flags, click_point = _calc_flags_and_coords(pressed, [x, y])
155-
for msg in first_click:
156-
win32functions.PostMessage(self.browser_window, msg, win32structures.WPARAM(flags), win32structures.LPARAM(click_point))
157-
time.sleep(press_timeout)
158-
# wait until the thread can accept another message
159-
win32functions.WaitGuiThreadIdle(self.browser_window.handle)
160-
161-
time.sleep(click_timeout)
162-
163-
for msg in second_click:
164-
win32functions.PostMessage(self.browser_window, msg, win32structures.WPARAM(flags), win32structures.LPARAM(click_point))
165-
time.sleep(press_timeout)
166-
# wait until the thread can accept another message
167-
win32functions.WaitGuiThreadIdle(self.browser_window.handle)
152+
for i in range(2):
153+
for msg in click:
154+
win32functions.PostMessage(self.browser_window, msg, win32structures.WPARAM(flags), win32structures.LPARAM(click_point))
155+
time.sleep(press_timeout)
156+
# wait until the thread can accept another message
157+
win32functions.WaitGuiThreadIdle(self.browser_window.handle)
158+
if not i:
159+
time.sleep(click_timeout)
168160

169161
def up(self, button: Literal["left", "right", "middle"], x: int, y: int, pressed: str = "") -> None:
170162
self.ensure_window()

cdp_patches/input/sync_input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def double_click(
130130

131131
press_timeout = click_timeout = timeout or self.sleep_timeout
132132
if self.emulate_behaviour and emulate_behaviour:
133-
# click_timeout = random.uniform(0.14, 0.21)
133+
click_timeout = random.uniform(0.14, 0.21)
134134
self._base.move(x=x, y=y)
135135

136136
kwargs = _mk_kwargs(pressed)

0 commit comments

Comments
 (0)