playwright
Automate browsers and E2E tests with Python Playwright: screenshots, traces.
Install
npx skills add https://github.com/fmind/dot/tree/main/skills/playwright
claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install fmind-dot@llmmart
git clone https://github.com/fmind/dot.git
The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole fmind/dot collection as a plugin from our marketplace. Git is the plain clone.
Skill manifest
Playwright
Browser automation and E2E testing (python-testing owns test structure and fixtures).
Workflow
- Check HTTP first: inspect status, headers, and bodies with xh; open a browser only for rendering, interaction, session state, or accessibility, targeting roles/labels and asserting state after each step.
- Pin Python packages:
uv add --dev playwright pytest-playwright(uv.lock), thenuv run playwright install chromium. Report missing OS libraries instead of running privilegedinstall-deps. - Record and capture:
uv run playwright codegen --target python-pytest <url>,uv run playwright screenshot <url> <file>(--viewport-size=390,844,--full-page), anduv run playwright pdf <url> <file>. Outside projects that lock Playwright, runuvx --from playwright==<version> playwright(installingchromiumfirst) instead of pollutingpyproject.toml. - Run and debug:
uv run pytest -q tests/e2e --browser chromium --tracing retain-on-failure --screenshot only-on-failure. Inspect traces in the shell viauv run playwright trace open <trace.zip>,trace --helpsubcommands, andtrace close(show-traceopens the GUI). For live CLI debugging, run one test in the background with--playwright-debug=cli -s, attach viauv run playwright cli attach <session>, then stop the run and remove.playwright-cli/.
Gotchas
- Respect authorization boundaries: testing never authorizes reusing personal browser profiles/cookies, creating accounts, accepting terms, hitting staging/prod unapproved, or bypassing login/MFA/CAPTCHA.
- Share
~/.cache/ms-playwright: install only needed browsers and never runplaywright uninstallin teardown (other projects share the cache); clean up only temp profiles and passing-run artifacts. - Reinstall after version bumps: rerun
uv run playwright install chromiumwhenever Playwright upgrades.
Official Skills
Upstream: microsoft/playwright-cli (CLI exploration only, not Python API); review under the vendor-skill policy. Preview—never install—same-name openai/skills playwright (name collisions). uv run playwright also bundles playwright-cli (uv run playwright cli --help prints its path), playwright-trace, and JS-only playwright-component-testing: audit allowed-tools before exposing (playwright <1.64 and playwright-cli <0.1.22 pre-approve all npx/npm; newer versions scope to npx playwright).
Documentation
- Playwright for Python · pytest plugin · Trace Viewer
- Releases: Playwright release notes · playwright-python
- Companion skills: python-stack, chrome-devtools (accessibility, Lighthouse, and performance audits), performance (load, not browser, testing).
Files (dot)
-
SKILL.md 3.6 KB
--- name: playwright description: "Automate browsers and E2E tests with Playwright: screenshots and traces." license: MIT metadata: kind: task author: Médéric HURIER (Fmind) source: github.com/fmind/dot/tree/main/skills/playwright created: "2026-09-02" updated: "2026-11-10" --- # Playwright Browser automation and E2E testing ([python-testing](../python-stack/references/python-testing/GUIDE.md) owns test structure and fixtures). ## Workflow 1. **Check HTTP first**: inspect status, headers, and bodies with [xh](../xh/SKILL.md); open a browser only for rendering, interaction, session state, or accessibility, targeting roles/labels and asserting state after each step. 1. **Pin Python packages**: `uv add --dev playwright pytest-playwright` (`uv.lock`), then `uv run playwright install chromium`. Report missing OS libraries instead of running privileged `install-deps`. 1. **Record and capture**: `uv run playwright codegen --target python-pytest <url>`, `uv run playwright screenshot <url> <file>` (`--viewport-size=390,844`, `--full-page`), and `uv run playwright pdf <url> <file>`. Outside projects that lock Playwright, run `uvx --from playwright==<version> playwright` (installing `chromium` first) instead of polluting `pyproject.toml`. 1. **Run and debug**: `uv run pytest -q tests/e2e --browser chromium --tracing retain-on-failure --screenshot only-on-failure`. Inspect traces in the shell via `uv run playwright trace open <trace.zip>`, `trace --help` subcommands, and `trace close` (`show-trace` opens the GUI). For live CLI debugging, run one test in the background with `--playwright-debug=cli -s`, attach via `uv run playwright cli attach <session>`, then stop the run and remove `.playwright-cli/`. ## Gotchas - **Respect authorization boundaries**: testing never authorizes reusing personal browser profiles/cookies, creating accounts, accepting terms, hitting staging/prod unapproved, or bypassing login/MFA/CAPTCHA. - **Share `~/.cache/ms-playwright`**: install only needed browsers and never run `playwright uninstall` in teardown (other projects share the cache); clean up only temp profiles and passing-run artifacts. - **Reinstall after version bumps**: rerun `uv run playwright install chromium` whenever Playwright upgrades. ## Official Skills Upstream: [microsoft/playwright-cli](https://github.com/microsoft/playwright-cli/tree/main/skills/playwright-cli) (CLI exploration only, not Python API); review under the [vendor-skill policy](../agent-project/references/vendor-skills.md). Preview—never install—same-name `openai/skills` `playwright` ([name collisions](../agent-project/references/vendor-skills.md#name-collisions)). `uv run playwright` also bundles `playwright-cli` (`uv run playwright cli --help` prints its path), `playwright-trace`, and JS-only `playwright-component-testing`: audit `allowed-tools` before exposing (`playwright <1.64` and `playwright-cli <0.1.22` pre-approve all `npx`/`npm`; newer versions scope to `npx playwright`). ## Documentation - [Playwright for Python](https://playwright.dev/python/docs/intro) · [pytest plugin](https://playwright.dev/python/docs/test-runners) · [Trace Viewer](https://playwright.dev/python/docs/trace-viewer) - Releases: [Playwright release notes](https://playwright.dev/python/docs/release-notes) · [playwright-python](https://github.com/microsoft/playwright-python/releases) - Companion skills: [python-stack](../python-stack/references/foundation/GUIDE.md), [chrome-devtools](../chrome-devtools/SKILL.md) (accessibility, Lighthouse, and performance audits), [performance](../python-stack/references/performance.md) (load, not browser, testing).
Comments (0)
Sign in to join the conversation.
Reviews (0)
No reviews yet.
No comments yet.