playwright-python
CLAUDE.md15k starsChanged 5 months agoApache-2.0View on GitHub
Guidance for Claude when working in this repository. Python bindings for Playwright. The Python client talks JSON over a pipe to the Node-based driver bundled in playwright/driver/. The pipe protocol is defined upstream in packages/protocol/src/protocol.yml. CONTRIBUTING.md has the full sequence. The short version (needs Node.js and npm for the driver build): If the system lacks python3-venv, uv venv env is an acceptable substitute (then uv pip install --python env/bin/python --upgrade pip). When changing public API, edit _impl/, then run ./scripts/update_api.sh.…
- Installs packages
- Commits and pushes
Trending
Quiet since July.about the whole repository
Who's talking about microsoft/playwright-python
- microsoft/playwright“[Feature] Directly set Proxy-Authorization in Chrome without configuring any other proxy settings”GitHub · Feb 9, 2022 · 65 reactions
- microsoft/playwright“[Feature] Support for Raspberry PI”GitHub · Jan 12, 2021 · 34 reactions
- microsoft/playwright“[Feature] Driver - allow to install only selected browsers”GitHub · Sep 13, 2020 · 14 reactions
- microsoft/playwright“[BUG] Opening page with large number of IFrames crashes/hangs playwright”GitHub · Nov 10, 2023 · 9 reactions
- microsoft/playwright“[BUG] Unable to access iframe in firefox (works with chromium and webkit)”GitHub · Nov 9, 2023 · 9 reactions
The biggest 5 of 22 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 22
Talked about on GitHub and Hacker News (22 times).
On GitHub · 20
- Feb 9, 2022[Feature] Directly set Proxy-Authorization in Chrome without configuring any other proxy settings — microsoft/playwright65 reactions · 11 comments
- Jan 12, 2021[Feature] Support for Raspberry PI — microsoft/playwright34 reactions · 8 comments
- Sep 13, 2020[Feature] Driver - allow to install only selected browsers — microsoft/playwright14 reactions · 3 comments
- Nov 10, 2023[BUG] Opening page with large number of IFrames crashes/hangs playwright — microsoft/playwright9 reactions · 7 comments
- Nov 9, 2023[BUG] Unable to access iframe in firefox (works with chromium and webkit) — microsoft/playwright9 reactions · 3 comments
15 more on GitHub
- Jan 30, 2026python3Packages.playwright: 1.57.0 -> 1.58.0 — NixOS/nixpkgs5 reactions · 1 comment
- Sep 17, 2023[Feature] Open Telemetry Tracing — microsoft/playwright5 reactions · 2 comments
- Jun 9, 2026Bump the uv-all group across 1 directory with 3 updates — Ven0m0/dot-termux3 reactions · 1 comment
- May 20, 2026Bump the pip-all group across 1 directory with 3 updates — Ven0m0/dot-termux3 reactions · 1 comment
- May 3, 2024[Feature]: Proper support for scrolling to the bottom of a page — microsoft/playwright3 reactions · 7 comments
- Dec 30, 2022Update playwright driver to 1.29.1 — YusukeIwaki/playwright-ruby-client3 reactions · 3 comments
- Jan 22, 2021[Feature](playwright-cli) Option to install system dependencies — microsoft/playwright3 reactions · 4 comments
- Jul 7, 2026Bump the uv-all group across 1 directory with 2 updates — Ven0m0/dot-termux2 reactions · 2 comments
- Jul 7, 2026Bump the pip-all group across 1 directory with 2 updates — Ven0m0/dot-termux2 reactions · 2 comments
- Jun 30, 2026Bump playwright from 1.60.0 to 1.61.0 in the uv-all group — Ven0m0/dot-termux2 reactions · 2 comments
- Jun 30, 2026Bump playwright from 1.60.0 to 1.61.0 in the pip-all group — Ven0m0/dot-termux2 reactions · 2 comments
- May 20, 2026chore(deps): update playwright requirement from >=1.40.0 to >=1.60.0 — EvezArt/evez-claw-extensions2 reactions · 1 comment
- May 12, 2026chore(deps): update playwright requirement from >=1.40.0 to >=1.59.0 — EvezArt/evez-claw2 reactions · 1 comment
- Mar 26, 2026new rule - suggest changing function parameter type to readonly alternative if parameter is not mutated inside the function — astral-sh/ruff2 reactions · 1 comment
- Feb 3, 2022Installation fails using PDM — pytorch/vision2 reactions · 3 comments
On Hacker News · 2
- Sep 30, 2020Python version of the Playwright testing and automation librarysays it tested it2 points
- Oct 5, 2020Playwright: Microsoft's end-to-end testing framework for Pythonsays it tested it1 point · 1 comment
In this repositoryOne other file it gives its agents.
- playwright-rollSkill
The file
We split this CLAUDE.md into the rules it gives an agent
12 rules. About 0 are common, 2 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 35
If the system lacks python3-venv, uv venv env is an acceptable substitute (then uv pip install --python env/bin/python --upgrade pip).
- Very specific: line 42
Run tests: pytest --browser chromium [-k name].
- Very specific: line 44
When changing public API, edit _impl/, then run ./scripts/update_api.sh.
- Distinctive: line 56
Never post comments, replies, or reviews on GitHub PRs/issues under my account without my explicit approval.
- Distinctive: line 60
Don't hand-edit generated files.
- Very specific: line 61
Don't add # type: ignore or modify _generated.py to silence pyright.
- Very specific: line 63
Keep expected_api_mismatch.txt minimal — every entry needs a one-line rationale comment above it.
- Very specific: line 64
Prefer locals_to_params(locals()) for forwarding optional kwargs to channel sends, matching the rest of the codebase.
- Very specific: line 68
Before committing, run mypy playwright and fix errors.
- Very specific: line 96
Never add Co-Authored-By agents in commit message.
- Very specific: line 97
Never add "Generated with" in commit message.
- Very specific: line 98
Never add test plan to PR description.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
Guidance for Claude when working in this repository.
What this is
Python bindings for Playwright. The Python client talks JSON over a pipe to the Node-based driver bundled in playwright/driver/. The pipe protocol is defined upstream in packages/protocol/src/protocol.yml.
Layout
playwright/_impl/— hand-written client implementation (one module per object:_browser.py,_page.py,_locator.py,_network.py, etc.). Edit these to add or change behavior.playwright/async_api/_generated.py,playwright/sync_api/_generated.py— auto-generated. Never edit by hand; rerun./scripts/update_api.shafter changing_impl/or the driver.scripts/generate_api.py,scripts/generate_async_api.py,scripts/generate_sync_api.py,scripts/documentation_provider.py— codegen and validation. They diff the Python implementation against Playwright'sapi.json(provided via thePW_API_JSONenv var; seescripts/update_api.sh) and abort if either side is out of sync.scripts/expected_api_mismatch.txt— explicit allowlist of "documented in JS, not in Python" or "named differently in Python" gaps. Lines that no longer apply must be removed.tests/async/,tests/sync/— pytest suites. Most new tests are added to the async file with a sync mirror.DRIVER_VERSION— the single source of truth for which Playwright release the driver is assembled from (one line, theplaywright-corenpm version, e.g.1.61.0, novprefix). Read bysetup.py,scripts/build_driver.py, and CI. The wheel build downloadsplaywright-coreat this version from npm plus the matching Node.js binary and assembles the per-platform bundles — no source build. The version is baked into the staged bundle filenames (driver/playwright-<version>-<suffix>.zip), so it doubles as the build cache key.NODE_VERSION— the Node.js version bundled with the driver (one line, e.g.24.16.0). Maintained at roll time byscripts/update_node_version.py(latest LTS, mirroring upstream'sutils/build/update-playwright-node.mjs).scripts/build_driver.py— assembles the per-platform driver bundles intodriver/by downloading theplaywright-corenpm package (DRIVER_VERSION) and the official Node.js binaries (NODE_VERSION). Fetchesplaywright-corewithnpm pack(needs Node.js/npm on PATH; honours a root.npmrc) and the Node.js binaries over plain HTTP; invoked fromsetup.py'sbdist_wheelwith the target platform's suffix (no arg builds all six).api.jsonis not shipped in the bundle and is never written into the driver —scripts/update_api.shgenerates it from a nearbymicrosoft/playwrightcheckout ($PW_SRC_DIR) into a temp file and passes it to codegen viaPW_API_JSON(read byscripts/documentation_provider.py). Needed only when regenerating the API, never at runtime.ROLLING.md,CONTRIBUTING.md— human-facing setup and roll docs.
Setup
CONTRIBUTING.md has the full sequence. The short version (needs Node.js and npm for the driver build):
python3 -m venv env && source env/bin/activate
pip install --upgrade pip
pip install -r local-requirements.txt
pip install -e .
python -m build --wheel # downloads playwright-core @ DRIVER_VERSION + Node.js and assembles the driver
pre-commit installIf the system lacks python3-venv, uv venv env is an acceptable substitute (then uv pip install --python env/bin/python --upgrade pip).
Common commands
- Regenerate
_generated.py:./scripts/update_api.sh(runs codegen + pre-commit on the generated files). - Lint everything:
pre-commit run --all-files. - Type-check:
mypy playwright. - Run tests:
pytest --browser chromium [-k name]. Browsers are installed viaplaywright install chromium(do not use--with-deps, which requires sudo).
When changing public API, edit _impl/, then run ./scripts/update_api.sh. The script regenerates _generated.py and validates against Playwright's api.json (which it generates from $PW_SRC_DIR). If validation fails, fix the mismatch in _impl/, in expected_api_mismatch.txt, or in documentation_provider.py — not by hand-editing _generated.py.
Rolling Playwright to a new version
This is the recurring high-stakes task. Use the dedicated skill:
→ .claude/skills/playwright-roll/SKILL.md
It documents the full process: the upstream commit-range diff over docs/src/api/, how to classify each commit (PORT / MISMATCH / N/A), how to handle the langs: filter, the recurring failure modes, and the tests/sync-mirroring conventions.
Working on PRs
- Never post comments, replies, or reviews on GitHub PRs/issues under my account without my explicit approval. Draft the proposed text and wait for me to approve before sending.
House style
- Don't hand-edit generated files.
- Don't add
# type: ignoreor modify_generated.pyto silence pyright; fix the source of the mismatch. - New public methods on impl classes need a sync test mirror under
tests/sync/. - Keep
expected_api_mismatch.txtminimal — every entry needs a one-line rationale comment above it. - Prefer
locals_to_params(locals())for forwarding optional kwargs to channel sends, matching the rest of the codebase.
Commit Convention
Before committing, run mypy playwright and fix errors.
Semantic commit messages: label(scope): description
Labels: fix, feat, chore, docs, test, devops
git checkout -b fix-12345
# ... make changes ...
git add <changed-files>
git commit -m "$(cat <<'EOF'
fix(asyncio): do not deadlock in atexit handler
Fixes: https://github.com/microsoft/playwright-python/issues/12345
EOF
)"
git push origin fix-12345
gh pr create --repo microsoft/playwright-python --head username:fix-12345 \
--title "fix(asyncio): do not deadlock in atexit handler" \
--body "$(cat <<'EOF'
## Summary
- <describe the change very! briefly>
Fixes https://github.com/microsoft/playwright-python/issues/12345
EOF
)"Never add Co-Authored-By agents in commit message.
Never add "Generated with" in commit message.
Never add test plan to PR description. Keep PR description short — a few bullet points at most.
Branch naming for issue fixes: fix-<issue-number>
Never git push without an explicit instruction to push. Applies even when a PR is already open for the branch — additional commits are immediately visible to reviewers. Commit locally, report what was committed, and wait. Only push when the user's message contains "push", "upload", "create PR", "ship it", or equivalent.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

