Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

playwright-cli

БесплатноБез исполняемых скриптовНе проверен

Playwright CLI browser automation — navigate, screenshot, fill forms, click. Use when automating browser tasks from the shell; 4-10x more token-efficient than…

laurigatesот laurigates★ 61 звезда на GitHub

Об этом скилле

Playwright CLI

Playwright CLI (@playwright/cli) is a terminal-first browser automation tool designed for AI coding agents. It provides shell commands for browser control, saving snapshots and screenshots to disk instead of injecting them into the LLM context window.

When to Use This Skill

Use this skill when... Use another skill instead when...
Automating browser tasks from CLI Writing E2E test suites (use playwright-testing)
Navigating pages, clicking, filling forms Sandboxed env without shell access (use Playwright MCP)
Taking screenshots or PDFs of web pages Testing across multiple browsers systematically (use playwright-testing)
Verifying UI state during development Setting up testing infrastructure (use configure-ux-testing)
Scraping or inspecting page content Short exploratory sessions needing rich DOM inspection (use MCP)

CLI vs MCP

Factor Playwright CLI Playwright MCP
Token cost per task ~27K tokens ~114K tokens
Schema overhead ~68 tokens (SKILL.md) ~3,600 tokens (26 tools)
Requires Shell/Bash access MCP server config
Output Files on disk Inline in context
Best for AI agents with shell (Claude Code, Copilot) Sandboxed envs (Claude Desktop, Cursor)

Rule of thumb: If the agent has Bash access, use CLI. If not, use MCP.

Installation

# Global install
npm install -g @playwright/cli@latest

# Project-local
npm install --save-dev @playwright/cli@latest

# Verify
playwright-cli --version

# If global binary not found
npx playwright-cli --version

Creates a .playwright-cli/ directory in the workspace for sessions, snapshots, and screenshots.

Core Workflow

The typical agent loop is: snapshot → find ref → interact → snapshot again.

# 1. Navigate to page
playwright-cli goto https://example.com

# 2. Capture snapshot (YAML with element refs like e21, e35)
playwright-cli snapshot

# 3. Read the snapshot to find element refs
cat .playwright-cli/snapshot.yaml

# 4. Interact using element refs
playwright-cli click e21
playwright-cli fill e35 "[email protected]"

# 5. Verify result
playwright-cli snapshot

Essential Commands

Navigation

playwright-cli open [url]           # Open browser, optionally navigate
playwright-cli goto <url>           # Navigate to URL
playwright-cli go-back              # Browser back
playwright-cli go-forward           # Browser forward
playwright-cli reload               # Reload page
playwright-cli close                # Close page

Interaction (using element refs from snapshots)

playwright-cli click <ref>          # Click element
playwright-cli dblclick <ref>       # Double-click
playwright-cli fill <ref> <text>    # Fill input field
playwright-cli type <text>          # Type into focused element
playwright-cli hover <ref>          # Hover over element
playwright-cli select <ref> <val>   # Select dropdown option
playwright-cli check <ref>          # Check checkbox
playwright-cli uncheck <ref>        # Uncheck checkbox
playwright-cli drag <start> <end>   # Drag and drop
playwright-cli upload <file>        # Upload file

Keyboard & Mouse

playwright-cli press Enter          # Press key
playwright-cli press Tab
playwright-cli keydown Shift        # Hold key
playwright-cli keyup Shift          # Release key
playwright-cli mousemove 150 300    # Move mouse to coordinates

Snapshots & Screenshots

playwright-cli snapshot                        # Page snapshot (YAML)
playwright-cli snapshot --filename=login.yaml  # Named snapshot
playwright-cli screenshot                      # Screenshot (PNG to disk)
playwright-cli pdf output.pdf                  # Save as PDF

Session Management

playwright-cli -s=myapp goto https://app.com  # Named session
playwright-cli -s=myapp snapshot               # Snapshot in session
playwright-cli list                            # List all sessions
playwright-cli -s=myapp close                  # Close session browser
playwright-cli close-all                       # Close all browsers
playwright-cli kill-all                        # Force kill all

Browser Options

playwright-cli open --headed             # Visible browser
playwright-cli open --persistent         # Persist cookies across restarts
playwright-cli -s=name delete-data       # Clear session data

Common Patterns

Form Submission

playwright-cli goto https://app.com/login
playwright-cli snapshot
# Read snapshot, find email/password/submit refs
playwright-cli fill e12 "[email protected]"
playwright-cli fill e15 "password123"
playwright-cli click e18
playwright-cli snapshot  # Verify redirect

Page Verification

playwright-cli goto https://app.com/dashboard
playwright-cli screenshot
playwright-cli snapshot
# Read snapshot to verify e
Полный SKILL.md на GitHub

Установить playwright-cli в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Bash(playwright-cli goto *)
Bash(playwright-cli click *)
Bash(playwright-cli dblclick *)
Bash(playwright-cli fill *)
Bash(playwright-cli type *)
Bash(playwright-cli press *)
Bash(playwright-cli keydown *)
Bash(playwright-cli keyup *)
Bash(playwright-cli hover *)
Bash(playwright-cli drag *)
Bash(playwright-cli select *)
Bash(playwright-cli check *)
Bash(playwright-cli uncheck *)
Bash(playwright-cli upload *)
Bash(playwright-cli snapshot *)
Bash(playwright-cli screenshot *)
Bash(playwright-cli pdf *)
Bash(playwright-cli mousemove *)
Bash(playwright-cli go-back *)
Bash(playwright-cli go-forward *)
Bash(playwright-cli reload *)
Bash(playwright-cli close *)
Bash(playwright-cli close-all *)
Bash(playwright-cli kill-all *)
Bash(playwright-cli list *)
Bash(playwright-cli open)
Bash(playwright-cli open --headed)
Bash(playwright-cli open --persistent)
Bash(playwright-cli --version)
Bash(npx playwright-cli --version)
Read
Grep
Glob
TodoWrite

FAQ

Что делает скилл playwright-cli?

Playwright CLI browser automation — navigate, screenshot, fill forms, click. Use when automating browser tasks from the shell; 4-10x more token-efficient than Playwright MCP.

Как установить скилл playwright-cli?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл playwright-cli запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить playwright-cli с