Playwright CLI for Openclaw

An advanced command-line tool for controlling headless and headed browsers, executing automated end-to-end tests, and managing web page states.

xutao0565
v1.0.0
Jun 15, 2026
0
475
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install playright-cli-zh

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 playright-cli-zh 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 CLI?

The playwright-cli skill is an outstanding browser automation toolkit designed to empower AI agents and developers with precise browser interaction and end-to-end testing capabilities. By exposing a full suite of Playwright commands over a simple CLI interface, it enables automated page navigation, DOM interaction, network mocking, and browser state management. It is a vital tool for those integrating robust web automation into their workflow with Openclaw Skills.

With this skill, you can seamlessly navigate complex single-page applications, simulate realistic user inputs, persist authentication states via cookies and storage state, and even request real-time annotated UI design feedback. It bridges the gap between raw web scraping and sophisticated automated browser interactions.

Playwright CLI Use Cases

  • Automated End-to-End Testing: Execute and debug Playwright test suites directly from the terminal or through an AI agent.
  • Web Scraping & Dynamic Content Extraction: Extract complex content from JavaScript-heavy websites by simulating user actions.
  • Network Mocking & Request Interception: Mock API responses or block unnecessary assets like images to accelerate test pipelines.
  • Session & Cookie Persistence: Save and restore authentication states using cookies, local storage, and session storage to bypass login screens.
  • Interactive Design Reviews: Collect real-time UI annotations and design feedback from users directly on the live page via the annotation dashboard.

How Playwright CLI Works

  1. Session Initialization: Start a headed or headless browser session using the open command, specifying target browsers (Chrome, Firefox, WebKit, Edge) or attaching to an existing session via CDP.
  2. Dynamic Snapshots: After every command execution, a snapshot of the page is saved under the .playwright-cli/ directory. Element references (e.g., e15) are generated automatically to make DOM elements addressable.
  3. Command Execution: Execute high-level commands like click, fill, upload, or eval using either the generated shorthand references, CSS selectors, or Playwright locators.
  4. State & Network Control: Manage browser storage (cookies, localStorage) and manipulate network requests using routing rules.
  5. Output Delivery: Return raw or JSON-formatted console feedback, screenshots, trace zip files, or video recordings to the caller.

Playwright CLI Setup

Prerequisites

Make sure Node.js and npm are installed on your environment.

Installation

Install the package globally via npm to make the CLI globally available:

npm install -g @playwright/cli@latest

If the global command is not accessible in your environment, you can run it via npx locally:

npx --no-install playwright-cli --version

Basic Verification

Launch a headless browser and navigate to a website to verify your setup:

playwright-cli open https://example.com
playwright-cli snapshot
playwright-cli close

Playwright CLI Data Schema & Taxonomy

This skill generates structured snapshot files, cookies, and trace records during automation. Here is how the workspace data is organized:

Directory / File Description Format
.playwright-cli/ Directory where automated session snapshots are stored Folder
*.yml / *.yaml Interactive page state snapshots with reference tags (e[id]) YAML
auth.json Saved state containing browser context cookies and storage state JSON
page.png Screenshots taken via the screenshot command PNG
page.pdf Document prints generated via the pdf command PDF
video.webm Screen recordings generated via the video-start command WebM

Playwright CLI Advanced Features

  • Interactive UI Annotations: Use playwright-cli show --annotate to launch a dashboard that allows users to draw markups and leave comments directly on the web page.
  • Raw Data Piping: Utilize the global --raw option to strip page state and snapshots, returning only raw outputs suitable for piping into shell utilities like jq or diff.
  • Network Routing & API Mocking: Mock API responses on the fly (e.g., playwright-cli route "https://api.example.com/**" --body='{"mock": true}') to test edge cases.
  • Custom JavaScript Execution: Run arbitrary scripts inside the page context using run-code or the eval command.
  • Multi-Tab Sessions: Manage isolated multi-tab workflows using tab control commands like tab-new and tab-select.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*