# 用于浏览器自动化和 UI 验证的 Playwright CLI
从命令行运行浏览器测试、生成 trace，并验证用户流程。
Agent Readiness Score: 90/100
Excellent for UI verification agents when flows are scoped and evidence is captured.
## Install

- npm init: `npm init playwright@latest`
- package: `npm install -D @playwright/test`

## Structured output

Supported output formats: json, junit, html, text.
Prefer structured output flags such as `--json`, `--format json`, or equivalent when available.

## Safe commands

- Run tests: `npx playwright test` — Runs browser tests in CI or locally.
- Open report: `npx playwright show-report` — Inspects the generated HTML report.

## Commands requiring approval

- Codegen: `npx playwright codegen https://example.com` — requires-review; require explicit user approval.

## Agent instructions

- Codex CLI: Use Playwright to verify local UI changes on desktop and mobile, capture evidence, and report console errors.

## Safety notes

- Browser automation should avoid destructive authenticated flows unless explicitly approved.
- Use screenshots, traces, and test reports as evidence for agent conclusions.

## Metadata

Official URL: https://playwright.dev/docs/test-cli
GitHub: https://github.com/microsoft/playwright
Docs: https://playwright.dev/docs/intro
