Playwright MCP Automation for Openclaw

A specialized skill for controlling real browser sessions via the Playwright MCP server to perform complex web interactions and UI automation.

zhanglinghao01-rakuten
v1.0.0
Mar 4, 2026
0
1.3k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install playwright-mcp-automation

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install playwright-mcp-automation using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Playwright MCP Automation?

The Playwright MCP Automation skill provides a robust interface for AI agents to drive a full browser instance, allowing them to perform actions that go far beyond simple HTTP fetches. By utilizing the Model Context Protocol (MCP), agents can navigate dynamic websites, interact with complex UI elements, and handle authenticated sessions securely. This capability is essential for workflows that require human-like browsing behavior within the Openclaw Skills ecosystem.

This skill is designed for reliability and observability, offering tools for capturing accessibility trees, taking screenshots, and executing custom JavaScript. Whether you are automating repetitive web tasks or building complex data extraction pipelines, this skill ensures your agent has the necessary vision and control to succeed in live web environments.

Playwright MCP Automation Use Cases

  • Automating e-commerce workflows such as searching for products, adding items to carts, and navigating to checkout.
  • Accessing authenticated dashboards to download statements, reports, or CSV data behind login walls.
  • Performing automated UI testing and capturing visual evidence through screenshots or PDF exports.
  • Scraping dynamic web content that requires JavaScript execution or complex user interactions like hovering and scrolling.

How Playwright MCP Automation Works

  1. The agent initializes the Playwright MCP server process using a dedicated launcher script or direct configuration.
  2. Navigation starts with the browser_navigate tool to reach the target web application.
  3. The agent performs a browser_snapshot to understand the page structure via the accessibility tree rather than raw HTML.
  4. Interactions such as browser_click, browser_fill_form, and browser_type are executed based on the agent's plan.
  5. For complex logic, the agent can use browser_run_code to execute custom asynchronous scripts directly within the page context.
  6. The session is monitored using browser_wait_for to ensure elements are loaded before proceeding to the next step.
  7. Upon completion, the agent saves any required artifacts and calls browser_close to release system resources.

Playwright MCP Automation Setup

Ensure you have Node.js 18 or higher installed, then set up the browser dependencies:

npx playwright install chromium
# For Linux users:
sudo npx playwright install-deps chromium

To integrate this with your agent, add the following configuration to your MCP client settings:

{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["@playwright/mcp@latest", "--browser=chromium", "--user-data-dir=/path/to/profile", "--allowed-hosts=*", "--snapshot-mode=incremental"]
    }
  }
}

Playwright MCP Automation Data Schema & Taxonomy

The skill manages browser state and outputs through a structured approach to ensure data persistence and auditability within Openclaw Skills:

Data Type Storage Method Purpose
Session State PWMCP_PROFILE directory Stores cookies, localStorage, and session data for persistent logins.
Page Snapshots JSON/Text Provides the agent with a semantic view of the page accessibility tree.
Visual Artifacts PNG/PDF Files Stores screenshots and saved documents generated during the session.
Execution Logs Stdout/Stderr Captures console messages and network request metadata for debugging.

Playwright MCP Automation Advanced Features

  • Persistent Profile Management: Maintain authenticated sessions across multiple agent runs to avoid frequent re-login steps.
  • Storage-State Bootstrapping: Launch browsers with pre-defined storage states (cookies/tokens) for seamless integration with existing auth flows.
  • Custom Script Injection: Use the browser_run_code tool for advanced automation logic that requires direct access to the Playwright Page API.
  • Multi-Tab Support: Manage and switch between multiple open browser tabs to handle pop-ups or parallel workflows.
  • Vision & Accessibility Mode: Toggle between accessibility tree snapshots and vision-based mouse controls for interacting with non-standard web elements.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*