playwright-browser
Use when automating browsers, testing pages, taking screenshots, checking UI, verifying login flows, or testing responsive behavior
What this skill does
<objective>
Browser automation via Playwright. Write scripts, execute via run.js.
</objective>
<execution>
Write Playwright code to /tmp, execute from skill directory:
```bash
node $SKILL_DIR/run.js /tmp/playwright-task.js
```
For inline code (variables are auto-injected, see below):
```bash
node $SKILL_DIR/run.js "const b = await chromium.launch(); const p = await b.newPage(); await p.goto('http://localhost:3000'); console.log(await p.title()); await b.close();"
```
$SKILL_DIR is where you loaded this file from. </execution>
<headless-vs-headed>
Default: headless (invisible, less intrusive).
Use `{ headless: false }` when user wants to see the browser. You know when that is.
</headless-vs-headed>
<defaults>
Screenshots to /tmp. Use `slowMo: 100` for debugging.
</defaults>
<injected-variables>
For inline code, these are available:
- `BASE_URL` - from PLAYWRIGHT_BASE_URL env var
- `CI_ARGS` - browser args for CI (`['--no-sandbox', '--disable-setuid-sandbox']`)
- `EXTRA_HEADERS` - from PW_HEADER_NAME/VALUE or PW_EXTRA_HEADERS
- `chromium`, `firefox`, `webkit`, `devices` - from playwright
Example:
```bash
node $SKILL_DIR/run.js "
const browser = await chromium.launch({ args: CI_ARGS });
const page = await browser.newPage();
await page.goto(BASE_URL || 'http://localhost:3000');
console.log(await page.title());
await browser.close();
"
```
</injected-variables>
<auto-install>
run.js auto-installs Playwright on first use. No manual setup needed.
</auto-install>
<advanced-patterns>
For network mocking, auth persistence, multi-tab, downloads, video, traces:
[API_REFERENCE.md](API_REFERENCE.md)
</advanced-patterns>
Related in testing
python-testing
IncludedPython testing patterns with pytest, fixtures, TDD, mocking, async and integration tests. Use when writing or auditing a Python test suite.
test-review
IncludedEvaluates test suites for coverage gaps, TDD/BDD compliance, and anti-patterns. Use when auditing test quality or before a major release.
Skill Validator
IncludedValidates that a skill or MCP implementation matches its manifest by running Codex-powered semantic comparisons across descriptions, preconditions, effects, and API surface.
unit-test-vue-pinia
IncludedWrite and review unit tests for Vue 3 + TypeScript + Vitest + Pinia codebases. Use when creating or updating tests for components, composables, and stores; mocking Pinia with createTestingPinia; applying Vue Test Utils patterns; and enforcing black-box assertions over implementation details.
subagent-testing
IncludedTest skills via TDD in fresh subagents. Use when validating behavior or preventing bias.
code-review
IncludedSystematic code review patterns covering security, performance, maintainability, correctness, and testing — with severity levels, structured feedback guidance, review process, and anti-patterns to avoid. Use when reviewing PRs, establishing review standards, or improving review quality.