# Openai Playwright

Use when the task requires automating a real browser from the terminal (navigation...

- Repository: https://github.com/trailofbits/skills-curated (523 stars)
- Category: Design
- License: CC-BY-SA-4.0
- Last updated: 2026-07-14
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add trailofbits/skills-curated --skill openai-playwright -g -a claude-code -y`
Codex: `npx skills add trailofbits/skills-curated --skill openai-playwright -g -a codex -y`
Cursor: `npx skills add trailofbits/skills-curated --skill openai-playwright -g -a cursor -y`
Gemini CLI: `npx skills add trailofbits/skills-curated --skill openai-playwright -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add trailofbits/skills-curated`

## Description

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. Originally from OpenAI's curated skills catalog.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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):

```bash
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:

```bash
# 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.

Scripts and references are located under `{baseDir}/`.

## Quick start

Use the wrapper script:

```bash
"$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:

```bash
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:

```bash
"$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.

## Recommended patterns

### Form fill and submit

The rest: https://github.com/trailofbits/skills-curated/blob/HEAD/plugins/openai-playwright/skills/openai-playwright/SKILL.md
