Playwright MCP Server

Browser automation and web testing capabilities through Playwright for automated web interactions and testing.

Browser Automation AutomationTestingBrowser

Configuration

MCP Settings Configuration

{
  "playwright": {
    "stdio": {
      "command": "npx",
      "args": [
        "@playwright/mcp@latest",
        "--headless",
        "--isolated"
      ]
    }
  }
}

Available Tools & Methods

browser_navigate(url)
Navigate to a URL
Parameters: url (string) - The URL to navigate to
browser_click(element, ref, doubleClick, button)
Perform click on a web page
Parameters: element (string), ref (string), doubleClick (boolean, optional), button (string, optional)
browser_type(element, ref, text, submit, slowly)
Type text into editable element
Parameters: element (string), ref (string), text (string), submit (boolean, optional), slowly (boolean, optional)
browser_fill_form(fields)
Fill multiple form fields
Parameters: fields (array) - Fields to fill in
browser_select_option(element, ref, values)
Select an option in a dropdown
Parameters: element (string), ref (string), values (array) - Array of values to select
browser_hover(element, ref)
Hover over element on page
Parameters: element (string), ref (string)
browser_drag(startElement, startRef, endElement, endRef)
Perform drag and drop between two elements
Parameters: startElement (string), startRef (string), endElement (string), endRef (string)
browser_press_key(key)
Press a key on the keyboard
Parameters: key (string) - Name of the key to press or a character (e.g., 'ArrowLeft', 'a')
browser_snapshot()
Capture accessibility snapshot of the current page, this is better than screenshot
Parameters: None
browser_take_screenshot(type, filename, element, ref, fullPage)
Take a screenshot of the current page. You can't perform actions based on the screenshot, use browser_snapshot for actions
Parameters: type (string, optional), filename (string, optional), element (string, optional), ref (string, optional), fullPage (boolean, optional)
browser_evaluate(function, element, ref)
Evaluate JavaScript expression on page or element
Parameters: function (string), element (string, optional), ref (string, optional)
browser_wait_for(time, text, textGone)
Wait for text to appear or disappear or a specified time to pass
Parameters: time (number, optional), text (string, optional), textGone (string, optional)
browser_close()
Close the page
Parameters: None
browser_navigate_back()
Go back to the previous page
Parameters: None
browser_resize(width, height)
Resize the browser window
Parameters: width (number), height (number)
browser_tabs(action, index)
List, create, close, or select a browser tab
Parameters: action (string), index (number, optional)
browser_file_upload(paths)
Upload one or multiple files
Parameters: paths (array) - The absolute paths to the files to upload
browser_handle_dialog(accept, promptText)
Handle a dialog
Parameters: accept (boolean), promptText (string, optional)
browser_console_messages()
Returns all console messages
Parameters: None
browser_network_requests()
Returns all network requests since loading the page
Parameters: None
browser_pdf_save(filename)
Save page as PDF (opt-in via --caps=pdf)
Parameters: filename (string, optional)
browser_verify_element_visible(role, accessibleName)
Verify element is visible on the page (opt-in via --caps=verify)
Parameters: role (string), accessibleName (string)
browser_verify_text_visible(text)
Verify text is visible on the page (opt-in via --caps=verify)
Parameters: text (string)
browser_install()
Install the browser specified in the config. Call this if you get an error about the browser not being installed
Parameters: None

Installation Guide

# Installation Please follow the setup guide: https://github.com/microsoft/playwright-mcp/tree/main