Catalog
openai/playwright

openai

playwright

Use when the task requires automating a real browser from the terminal (navigation, form filling, snapshots, screenshots, data extraction, UI-flow debugging) via `playwright-cli` or the bundled wrapper script.

global
0installs0uses~932
v1.0Saved Apr 5, 2026

Playwright CLI Skill

Drive a real browser from the terminal using playwright-cli. Prefer the bundled wrapper script so the CLI works even when it is not globally installed. Treat this skill as CLI-first automation. Do not pivot to @playwright/test unless the user explicitly asks for test files.

Prerequisite check (required)

Before proposing commands, check whether npx is available (the wrapper depends on it):

command -v npx >/dev/null 2>&1

If it is not available, pause and ask the user to install Node.js/npm (which provides npx). Provide these steps verbatim:

# Verify Node/npm are installed
node --version
npm --version

# If missing, install Node.js/npm, then:
npm install -g @playwright/cli@latest
playwright-cli --help

Once npx is present, proceed with the wrapper script. A global install of playwright-cli is optional.

Skill path (set once)

export CODEX_HOME="${CODEX_HOME:-$HOME/.codex}"
export PWCLI="$CODEX_HOME/skills/playwright/scripts/playwright_cli.sh"

User-scoped skills install under $CODEX_HOME/skills (default: ~/.codex/skills).

Quick start

Use the wrapper script:

"$PWCLI" open https://playwright.dev --headed
"$PWCLI" snapshot
"$PWCLI" click e15
"$PWCLI" type "Playwright"
"$PWCLI" press Enter
"$PWCLI" screenshot

If the user prefers a global install, this is also valid:

npm install -g @playwright/cli@latest
playwright-cli --help

Core workflow

  1. Open the page.
  2. Snapshot to get stable element refs.
  3. Interact using refs from the latest snapshot.
  4. Re-snapshot after navigation or significant DOM changes.
  5. Capture artifacts (screenshot, pdf, traces) when useful.

Minimal loop:

"$PWCLI" open https://example.com
"$PWCLI" snapshot
"$PWCLI" click e3
"$PWCLI" snapshot

When to snapshot again

Snapshot again after:

  • navigation
  • clicking elements that change the UI substantially
  • opening/closing modals or menus
  • tab switches

Refs can go stale. When a command fails due to a missing ref, snapshot again.

Form fill and submit

"$PWCLI" open https://example.com/form
"$PWCLI" snapshot
"$PWCLI" fill e1 "user@example.com"
"$PWCLI" fill e2 "password123"
"$PWCLI" click e3
"$PWCLI" snapshot

Debug a UI flow with traces

"$PWCLI" open https://example.com --headed
"$PWCLI" tracing-start
# ...interactions...
"$PWCLI" tracing-stop

Multi-tab work

"$PWCLI" tab-new https://example.com
"$PWCLI" tab-list
"$PWCLI" tab-select 0
"$PWCLI" snapshot

Wrapper script

The wrapper script uses npx --package @playwright/cli playwright-cli so the CLI can run without a global install:

"$PWCLI" --help

Prefer the wrapper unless the repository already standardizes on a global install.

References

Open only what you need:

  • CLI command reference: references/cli.md
  • Practical workflows and troubleshooting: references/workflows.md

Guardrails

  • Always snapshot before referencing element ids like e12.
  • Re-snapshot when refs seem stale.
  • Prefer explicit commands over eval and run-code unless needed.
  • When you do not have a fresh snapshot, use placeholder refs like eX and say why; do not bypass refs with run-code.
  • Use --headed when a visual check will help.
  • When capturing artifacts in this repo, use output/playwright/ and avoid introducing new top-level artifact folders.
  • Default to CLI commands and workflows, not Playwright test specs.
Files8
8 files · 18.6 KB

Select a file to preview

Overall Score

86/100

Grade

A

Excellent

Safety

84

Quality

89

Clarity

86

Completeness

85

Summary

This skill teaches an AI agent to automate real browser interactions from the terminal using Playwright CLI. It provides a wrapper script to invoke the CLI without global installation, documents core workflows (form filling, snapshots, element interaction, tracing), and emphasizes snapshot-based element referencing to ensure stable automation.

Static Analysis Findings

1 finding

Patterns detected by deterministic static analysis before AI scoring. Hover over any finding code for detailed information and remediation guidance.

Command Injection
SEC-011Dynamic Shell Eval6x in 4 files

Shell eval/exec of dynamic content

SKILL.mdeval`
scripts/playwright_cli.shexec "
references/cli.mdeval "2x

Detected Capabilities

Browser automation via Playwright CLI (open, click, type, fill, navigate)Element snapshot and reference-based interactionSession management for isolated browser contextsArtifact capture (screenshots, PDFs, traces, console logs)NPX-based wrapper script for CLI execution without global installMulti-tab and keyboard/mouse event handling

Trigger Keywords

Phrases that MCP clients use to match this skill to user intent.

browser automationautomate ui workflowweb scrapingform fill submitelement snapshotplaywright debugging

Risk Signals

WARNING

eval command in CLI reference (pwcli eval "document.title")

references/cli.md, line: eval examples
WARNING

eval command in workflows reference (pwcli eval "document.title")

references/workflows.md, line: data extraction section
INFO

exec statement in wrapper script (exec "${cmd[@]}")

scripts/playwright_cli.sh, line: final exec call
INFO

SKILL.md guardrail against eval ("Prefer explicit commands over eval")

SKILL.md, Guardrails section

Referenced Domains

External domains referenced in skill content, detected by static analysis.

demo.playwright.devexample.complaywright.devwww.apache.org

Use Cases

  • Automate UI workflows: navigation, form filling, clicking, typing
  • Extract data from web pages using element snapshots and eval commands
  • Debug browser interactions with traces, console logs, and screenshots
  • Test multi-tab flows and modal/menu interactions
  • Capture artifacts (PDFs, screenshots, traces) for inspection

Quality Notes

  • Well-structured documentation with clear sections: prerequisite check, quick start, core workflow, recommended patterns
  • Excellent guardrails documented explicitly: snapshot before refs, re-snapshot when stale, prefer explicit commands over eval
  • Good error handling guidance: checks for npx availability before proceeding, provides fallback installation steps
  • Strong scope boundaries: skill is CLI-first, avoids pivoting to @playwright/test unless explicitly requested
  • Practical examples throughout (form fill, multi-tab, tracing, data extraction) with clear command sequences
  • References well-organized: cli.md for command reference, workflows.md for practical patterns
  • Wrapper script uses defensive shell practices: set -euo pipefail, validates npx, handles session flags cleanly
  • Session management documented to help users isolate work across projects
  • Eval usage is documented in reference files as an available command, but the skill guardrail explicitly discourages it in favor of explicit commands—this is appropriate defensive guidance
  • All supporting files (cli.md, workflows.md, wrapper script) are present and referenced
Model: claude-haiku-4-5-20251001Analyzed: Apr 5, 2026

Reviews

Add this skill to your library to leave a review.

No reviews yet

Be the first to share your experience.

Add openai/playwright to your library

Command Palette

Search for a command to run...