Skip to content

Bug Fix for playwright-cli drag, drag is failing with Zod validation error#40146

Open
sachinvarma-sf wants to merge 2 commits intomicrosoft:mainfrom
sachinvarma-sf:pw-drag
Open

Bug Fix for playwright-cli drag, drag is failing with Zod validation error#40146
sachinvarma-sf wants to merge 2 commits intomicrosoft:mainfrom
sachinvarma-sf:pw-drag

Conversation

@sachinvarma-sf
Copy link
Copy Markdown

@sachinvarma-sf sachinvarma-sf commented Apr 10, 2026

Expected behavior:
Expected: Drag-and-drop is performed between the two elements.

Actual behavior:
Zod validation error

[
  {
    "expected": "string",
    "code": "invalid_type",
    "path": ["startElement"],
    "message": "Invalid input: expected string, received undefined"
  },
  {
    "expected": "string",
    "code": "invalid_type",
    "path": ["endElement"],
    "message": "Invalid input: expected string, received undefined"
  }
]

Additional context

Root Cause:

The CLI daemon's drag command (playwright-core/lib/tools/cli-daemon/commands.js) converts positional args into startRef/endRef but never passes startElement/endElement to the MCP tool

Test added:

npm run ctest-mcp tests/mcp/cli-drag.spec.ts

Running 1 test using 1 worker

✓ 1 [chrome] › tests/mcp/cli-drag.spec.ts:19:5 › drag between elements (3.6s)

1 passed (4.2s)

@sachinvarma-sf
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="salesforce"

@sachinvarma-sf sachinvarma-sf changed the title playwright-cli drag fails with Zod validation error Issue: https://github.com/microsoft/playwright/issues/40145 playwright-cli drag fails with Zod validation error Apr 10, 2026
@sachinvarma-sf sachinvarma-sf changed the title playwright-cli drag fails with Zod validation error Bug Fix for playwright-cli drag, drag is failing with Zod validation error Apr 10, 2026
@sachinvarma-sf
Copy link
Copy Markdown
Author

Here’s another issue caused by the same bug - microsoft/playwright-cli#354

@github-actions
Copy link
Copy Markdown
Contributor

Test results for "MCP"

6481 passed, 383 skipped


Merge workflow run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants