Skip to content

Commit a60dea0

Browse files
committed
fix: adjust scrolling param
1 parent 687e0e6 commit a60dea0

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/playwright_computer_use/async_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from dataclasses import dataclass
1919

2020
TYPING_DELAY_MS = 12
21+
SCROLL_MULTIPLIER_FACTOR = 500
2122
TYPING_GROUP_SIZE = 50
2223

2324
Action_20241022 = Literal[
@@ -411,7 +412,7 @@ async def __call__(
411412
x, y = coordinate
412413
await self.page.mouse.move(x, y)
413414
self.mouse_position = (x, y)
414-
scroll_amount *= 100
415+
scroll_amount *= SCROLL_MULTIPLIER_FACTOR
415416
scroll_params = {
416417
"up": {"delta_y": -scroll_amount, "delta_x": 0},
417418
"down": {"delta_y": scroll_amount, "delta_x": 0},

src/playwright_computer_use/sync_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
ScrollDirection,
2222
chunks,
2323
TYPING_GROUP_SIZE,
24+
SCROLL_MULTIPLIER_FACTOR,
2425
to_playwright_key,
2526
load_cursor_image,
2627
_make_api_tool_result,
@@ -356,7 +357,7 @@ def __call__(
356357
x, y = coordinate
357358
self.page.mouse.move(x, y)
358359
self.mouse_position = (x, y)
359-
scroll_amount *= 100
360+
scroll_amount *= SCROLL_MULTIPLIER_FACTOR
360361
scroll_params = {
361362
"up": {"delta_y": -scroll_amount, "delta_x": 0},
362363
"down": {"delta_y": scroll_amount, "delta_x": 0},

0 commit comments

Comments
 (0)