playwright-python
Installation
SKILL.md
Playwright in Python
Playwright drives a real browser (Chromium/Firefox/WebKit) from Python. Use it for three things in this repo:
- Visual verification — screenshot a running app so Claude can
Readthe PNG and see what the user sees. This closes the loop when iterating on a UI: edit code → screenshot → look → edit again. - Scraping rendered pages — anything that needs JavaScript to run (SPAs, dashboards, lazy-loaded data).
- End-to-end testing with pytest —
pytest-playwrightships fixtures so each test gets a freshpage.
The async API is the default. Use sync only when calling from a script that can't run an event loop (rare) or from a notebook that already has one running (also rare; prefer async there too).
When NOT to use this
- The page is plain HTML with no JS —
httpxorrequests+selectolax/beautifulsoup4is faster and lighter. - You need a headless API client — Playwright is for browsers. Use
httpxfor raw HTTP. - The reference skill
microsoft/playwright-cliis a stateful Node CLI; this skill is the Python alternative. Don't conflate them.
Install (handle this first if missing)
Playwright has two install steps that are easy to forget: