Skip to content

Playwright MCP and API

Playwright controls a local browser to navigate pages, fill forms and capture screenshots. An agent can navigate pages, fill forms and capture browser output for website checks. Longwave installs the Playwright MCP server and runs it on your machine, with no account or key.

Add to Longwave

Install elsewhere

Install Playwright

Choose a harness. These instructions start the same local MCP server shown on this page.

Claude Code

Run this in your terminal. It adds a user-scoped server; use --scope project instead if it should apply only to the current project.

terminal
claude mcp add --scope user --transport stdio playwright -- npx -y @playwright/[email protected] --browser chromium
functions
44
access
Runs locally

Use Playwright on Longwave

  1. Download Longwave or open app.longwave.run.
  2. Longwave installs the Playwright MCP server and runs it on your machine, with no account or key.
  3. Ask for the result in any thread, for example: “Check a signup form in a browser”. The agent picks the Playwright function and calls it.

Playwright functions

MCP server 24

Function
browser_click Perform click on a web page
browser_close Close the page
browser_console_messages Returns all console messages
browser_drag Perform drag and drop between two elements
browser_drop Drop files or MIME-typed data onto an element, as if dragged from outside the page. At least one of "paths" or "data" must be provided.
browser_evaluate Evaluate JavaScript expression on page or element
browser_file_upload Upload one or multiple files
browser_fill_form Fill multiple form fields
browser_find Search the accessibility snapshot of the current page for text or a regular expression. Returns matching snapshot nodes with a few lines of surrounding context (like search snippets), each shown under its path from the root of the tree, which is cheaper than capturing the whole snapshot when you only need to locate an element and its ref.
browser_handle_dialog Handle a dialog
browser_hover Hover over element on page
browser_navigate Navigate to a URL
browser_navigate_back Go back to the previous page in the history
browser_network_request Returns full details (headers and body) of a single network request, or a single part if `part` is set. Use the number from browser_network_requests.
browser_network_requests Returns a numbered list of network requests since loading the page. Use browser_network_request with the number to get full details.
browser_press_key Press a key on the keyboard
browser_resize Resize the browser window
browser_run_code_unsafe Run a Playwright code snippet. Unsafe: executes arbitrary JavaScript in the Playwright server process and is RCE-equivalent.
browser_select_option Select an option in a dropdown
browser_snapshot Capture accessibility snapshot of the current page, this is better than screenshot
browser_tabs List, create, close, or select a browser tab.
browser_take_screenshot Take a screenshot of the current page. You can't perform actions based on the screenshot, use browser_snapshot for actions.
browser_type Type text into editable element
browser_wait_for Wait for text to appear or disappear or a specified time to pass

DevTools 13

Function
browser_annotate Open the Playwright Dashboard in annotation mode for the current page and wait for the user to draw annotations. Returns the annotated screenshot, ARIA snapshot, and the list of annotations.
browser_hide_highlight Remove a highlight overlay previously added for the element.
browser_highlight Show a persistent highlight overlay around the element on the page.
browser_resume Resume script execution after it was paused. When called with step set to true, execution will pause again before the next action.
browser_start_recording Start recording actions that the user performs in the browser as Playwright code. Use it when the user wants to demonstrate a flow manually. Call browser_stop_recording when the user says they are done to retrieve the recorded actions.
browser_start_tracing Start trace recording
browser_start_video Start video recording
browser_stop_recording Stop the recording started with browser_start_recording and return the recorded actions as Playwright code.
browser_stop_tracing Stop trace recording
browser_stop_video Stop video recording
browser_video_chapter Add a chapter marker to the video recording. Shows a full-screen chapter card with blurred backdrop.
browser_video_hide_actions Stop annotating actions performed on the page.
browser_video_show_actions Annotate subsequent actions performed on the page with a callout that names the action and highlights the target element. Useful while video recording or screencasting.

Vision 6

Function
browser_mouse_click_xy Click mouse button at a given position
browser_mouse_down Press mouse down
browser_mouse_drag_xy Drag left mouse button to a given position
browser_mouse_move_xy Move mouse to a given position
browser_mouse_up Press mouse up
browser_mouse_wheel Scroll mouse wheel

PDF 1

Function
browser_pdf_save Save page as PDF

Use cases

Questions people ask

Does Playwright MCP require screenshots to read a page?

Playwright MCP uses structured accessibility snapshots for page interactions. It also provides screenshot tools when an image is needed. Playwright documentation

Which browser engines does Playwright support?

Playwright supports Chromium, Firefox and WebKit. The MCP server documentation describes its browser selection and launch options. Playwright documentation

How do I add the Playwright MCP server to Claude Code?

Run claude mcp add playwright -- npx -y @playwright/[email protected] --browser chromium in a terminal. Longwave installs the Playwright MCP server and runs it on your machine, with no account or key.

Who publishes the Playwright MCP server?

Microsoft publishes the Playwright MCP server that Longwave installs. Source code

Use Playwright in Longwave

Call Playwright from any agent thread, on your machine or in the cloud.

Add to Longwave