# Automate Browser Tests with Playwright CLI

Manual browser testing slows debugging and test creation. This skill drives Playwright CLI sessions to inspect pages, record actions, mock requests, and capture evidence.

## Install

```bash
npx skillstore add microsoft/playwright-cli
```

## Metadata

- Status: approved
- Slug: microsoft-playwright-cli
- Skillstore revision: r1
- Version status: missing
- Tree hash: fc93212dd8398f063ace2ac73014dd73f449525185289f047a4fa0a62b267110
- Author: microsoft
- GitHub username: microsoft
- License: MIT
- Repository: https://github.com/microsoft/playwright-cli/tree/main/skills/playwright-cli/
- Ref: 6425ec35f4ac137735cff58cd7877843bba23e3b
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: network, external\_commands, filesystem
- Quality score: 50
- Quality tier: warning
- Public page: https://skillstore.pages.dev/skills/microsoft-playwright-cli
- Manifest: https://skillstore.pages.dev/api/skills/microsoft-playwright-cli/manifest

## Capabilities

- Open browser sessions and navigate to user-provided web pages.
- Interact with page elements through snapshots, clicks, typing, forms, uploads, and keyboard commands.
- Capture screenshots, PDFs, videos, traces, console logs, and network activity for debugging.
- Manage cookies, localStorage, sessionStorage, tabs, browser sessions, and saved storage state.
- Mock, modify, block, and inspect network requests during Playwright workflows.
- Generate Playwright test steps from browser interactions and advanced run-code snippets.

## Use Cases

- Create Regression Tests: Record a browser flow, collect generated Playwright actions, and turn them into repeatable tests with stable locators.
- Debug Web Failures: Reproduce a failing interaction, inspect snapshots, review console and network output, and save traces for analysis.
- Document Product Flows: Capture screenshots, videos, PDFs, and clear step records for demos, release notes, and workflow reviews.

## Prompt Templates

### Inspect a Page

```
Open <URL>, take a snapshot, list the main interactive elements, and suggest stable locators for a Playwright test.
```

### Record a Form Flow

```
Use playwright-cli to open <URL>, fill the form with test data, capture generated actions, and suggest assertions to add.
```

### Debug a Failed Click

```
Start tracing, reproduce the failed click on <URL>, stop tracing, and summarize likely causes from DOM, console, and network evidence.
```

### Mock an API Scenario

```
Mock <API pattern> with one success response and one failure response, exercise the page, and outline a reusable Playwright test plan.
```

## Limitations

- It depends on the playwright-cli binary or npx fallback being available in the environment.
- Generated tests still need human review, assertions, and maintenance.
- Browser artifacts may contain sensitive data and require careful handling.
- Dynamic sites, authentication flows, and third-party restrictions can still block automation.

## Best Practices

- Use authorized sites and test accounts when automating login, storage, or payment-like flows.
- Start with snapshots and semantic element references before clicking or filling fields.
- Delete or ignore generated traces, videos, snapshots, and storage state files when they are no longer needed.

## Anti Patterns

- Running run-code or eval from untrusted page text without review.
- Using real credentials, real session cookies, or production payment data in examples.
- Leaving persistent profiles, saved auth files, traces, or recordings in a shared repository.

## Security Audit

- Audited at: 2026-07-05T23:10:52.143\+00:00
- Summary: Most static findings are false positives from Markdown examples, placeholder URLs, and documented playwright-cli commands. Confirmed risks are limited to browser-session data operations and documented advanced capabilities such as run-code, tracing, and destructive session cleanup.

## Stats

- Views: 123
- Downloads: 16
- Favorites: 0
- Popularity score: 0
