Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(cli): correct mousewheel delta mapping (#39716)

Alex Tumanovb02edbad57f3
diff --git a/packages/playwright-core/src/tools/cli-daemon/commands.ts b/packages/playwright-core/src/tools/cli-daemon/commands.ts
index 69dfc9439f..7f7d1f9cc0 100644
--- a/packages/playwright-core/src/tools/cli-daemon/commands.ts
+++ b/packages/playwright-core/src/tools/cli-daemon/commands.ts
@@ -212,11 +212,11 @@ const mouseWheel = declareCommand({
description: 'Scroll mouse wheel',
category: 'mouse',
args: z.object({
- dx: numberArg.describe('Y delta'),
- dy: numberArg.describe('X delta'),
+ dx: numberArg.describe('X delta'),
+ dy: numberArg.describe('Y delta'),
}),
toolName: 'browser_mouse_wheel',
- toolParams: ({ dx: deltaY, dy: deltaX }) => ({ deltaY, deltaX }),
+ toolParams: ({ dx: deltaX, dy: deltaY }) => ({ deltaX, deltaY }),
});
// Core
diff --git a/tests/mcp/cli-mouse.spec.ts b/tests/mcp/cli-mouse.spec.ts
index 5ce183c07e..59060c747f 100644
--- a/tests/mcp/cli-mouse.spec.ts
+++ b/tests/mcp/cli-mouse.spec.ts
@@ -45,5 +45,5 @@ test('mousewheel', async ({ cli, server }) => {
await cli('mousewheel', '10', '5');
- await expect.poll(() => cli('snapshot').then(result => result.snapshot)).toContain('wheel 5 10');
+ await expect.poll(() => cli('snapshot').then(result => result.snapshot)).toContain('wheel 10 5');
});