Skip to main content
Glama

¿Cómo utilizar playwright-mcp?

versión npm Documentos

Introducción

playwright-mcp (Protocolo de Contexto de Modelo) es una potente herramienta que conecta los asistentes de IA con la automatización de navegadores. Permite que los modelos de IA interactúen con navegadores web, inspeccionen elementos DOM, registren las interacciones del usuario y generen scripts de prueba de Playwright con mayor precisión. Esta guía le guiará en la configuración y el uso eficaz de playwright-mcp.

Related MCP server: browser-devtools-mcp

Herramientas

Herramientas disponibles en la interfaz del navegador:

Caja de herramientas del navegador

  1. Seleccionar DOM (🎯): Haz clic para seleccionar y capturar elementos HTML de la página. Úsalo para registrar selectores para tus casos de prueba.

  2. Seleccionar imagen (📸): Captura capturas de pantalla de elementos específicos. Útil para pruebas visuales o documentación.

  3. Registrar interacciones (📋): Registra las interacciones del navegador, como clics, entradas y navegaciones. Estas interacciones generan selectores automáticamente y pueden pasarse como contexto a clientes MCP como Claude o Cursor para facilitar la creación de casos de prueba.

Comandos MCP

  1. init-browser : Inicializa el navegador del dramaturgo.

  2. get-context : obtiene el contexto del sitio web, que se utilizará para escribir el caso de prueba

  3. execute-code : ejecuta código JS de Playwright personalizado en la página actual

  4. get-screenshot : Obtener una captura de pantalla de la página actual

  5. get-full-dom : Obtiene el DOM completo de la página actual. (Se recomienda usar get-context )

Más información

¿Quieres profundizar más? Consulta la documentación completa:

📖 Ver documentación

Available Tools

5 tools
execute-codeA

Execute custom Playwright JS code against the current page

Inputs: code (required).

get-contextB

Get the website context which would be used to write the testcase

Inputs: no named parameters.

get-full-domA

Get the full DOM of the current page. (Deprecated, use get-context instead)

Inputs: no named parameters.

get-screenshotB

Get a screenshot of the current page

Inputs: no named parameters.

init-browserC

Initialize a browser with a URL

Inputs: url (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 5 tools

    Disambiguation3/5

    Most tools have distinct purposes, but get-context and get-full-dom overlap significantly, with the latter deprecated in favor of the former. This creates ambiguity about which to use for DOM-related tasks, though the deprecation note helps clarify.

    Naming Consistency4/5

    The tools follow a consistent verb_noun pattern with hyphens, such as execute-code and get-screenshot. The only minor deviation is init-browser, which uses 'init' instead of a more standard verb like 'initialize', but overall the naming is predictable and readable.

    Tool Count4/5

    With 5 tools, the count is reasonable for a Playwright automation server, covering core operations like initialization, execution, and inspection. It might benefit from additional tools for actions like navigation or element interaction, but it's well-scoped for basic functionality.

    Completeness3/5

    The tools cover initialization, code execution, and page inspection, but there are notable gaps for common Playwright workflows, such as navigation (e.g., go-to-url), element interaction (e.g., click, fill), or test assertion. This limits the server's ability to handle full automation tasks without workarounds.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers