playwright-mcp-internal

testing MCP Server

Playwright MCP server

Install Ready
testingtesting
18 views33,512 stars2,760 forksv0.0.68Apache-2.0

Why This Matters

Discovered via unknown and last synced 3mo ago.

Install Ready
Source
unknown
Stars
33,512
Last synced
3mo ago
Install
Instructions detected

Install

1. Install the package

npx @playwright/mcp

2. Add to claude_desktop_config.json

{
  "mcpServers": {
    "playwright-mcp-internal": {
      "command": "npx",
      "args": [
        "@playwright/mcp"
      ]
    }
  }
}

Config file location: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) / %APPDATA%\Claude\claude_desktop_config.json (Windows)

34
Tools
0
Resources
0
Prompts
Standard I/O
Transport

Who Is This For?

QA engineers and test automation developers who need to interact with web applications programmatically during testing. Frontend developers building integration tests benefit from precise element interaction capabilities. Teams using Claude AI as a coding assistant gain the ability to automate complex browser interactions through natural language.

Use Cases

Automate complex user workflows in tests

Chain multiple interactions like clicks, typing, and scrolling to simulate realistic user journeys. Capture element references from page snapshots to ensure reliable element targeting across test runs.

Debug flaky tests with precise element data

Use exact element references and coordinates to identify why interactions fail. Compare snapshots before and after actions to verify page state changes.

Generate test code from natural language

Describe test scenarios to Claude, which translates them into playwright interactions using tool parameters. Reduces boilerplate while maintaining precise element targeting via ref attributes.

Handle dynamic forms with modifier keys

Interact with complex inputs requiring keyboard modifiers or delta-based scrolling. Test accessibility features and keyboard-driven interfaces systematically.

Frequently Asked Questions

How do I target the right element when the page has duplicates?

Use the exact `ref` parameter from the page snapshot—each element has a unique reference string. For complex selections, provide both `startRef` and `endRef` to define a precise interaction range.

Can I interact with elements that require precise coordinates?

Yes. Use `startX`, `startY`, and `deltaY` parameters for pixel-level control. This is especially useful for drag operations, scrolling, or clicking specific positions within large elements.

How does this integrate with Claude for test generation?

Provide Claude with your page snapshot and describe your test scenario in plain language. Claude uses the tool parameters to generate executable playwright commands with accurate element references and coordinates.

What happens if the page structure changes between test runs?

Element references may become invalid if the DOM changes significantly. Always capture fresh snapshots before running interactions, and use `endElement` descriptions to help identify elements if references drift.

Available Tools (34)

promptText

(string, optional): The text of the prompt in case of a prompt dialog.

Tools

generated by update-readme.js -->

startRef

(string): Exact source element reference from the page snapshot

endElement

(string): Human-readable target element description used to obtain the permission to interact with the element

endRef

(string): Exact target element reference from the page snapshot

startX

(number): Start X coordinate

NOTE

This has been generated via update-readme.js -->

ref

(string): Exact target element reference that points to the element

modifiers

(array, optional): Modifier keys to press

deltaY

(number): Y delta

submit

(boolean, optional): Whether to submit entered text (press Enter after)

slowly

(boolean, optional): Whether to type one character at a time. Useful for triggering key handlers in the page. By default entire text is filled in at once.

Title

Verify value

element

(string): Human-readable element description

End

of tools generated section -->

index

(number, optional): Tab index, used for close/select. If omitted for close, current tab is closed.

x

(number): X coordinate

height

(number): Height of the browser window

fullPage

(boolean, optional): When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Cannot be used with element screenshots.

accessibleName

(string): ACCESSIBLE_NAME of the element. Can be found in the snapshot like this: `- role "{ACCESSIBLE_NAME}"`

items

(array): Items to verify

values

(array): Array of values to select in the dropdown. This can be a single value or multiple values.

Description

Verify element value

Parameters

- `type` (string): Type of the element

value

(string): Value to verify. For checkbox, use "true" or "false".

text

(string, optional): The text to wait for

textGone

(string, optional): The text to wait for to disappear

startY

(number): Start Y coordinate

filename

(string, optional): File name to save the screenshot to. Defaults to `page-{timestamp}.{png|jpeg}` if not specified. Prefer relative file names to stay within the output directory.

endX

(number): End X coordinate

endY

(number): End Y coordinate

doubleClick

(boolean, optional): Whether to perform a double click instead of a single click

button

(string, optional): Button to click, defaults to left

y

(number): Y coordinate