Playwright (Python)
High-level Python API for automating browser testing and web scraping.
3. Used by agents' projects
Dependency in 76 public GitHub projects set up for AI coding agents that we scanned (1.2%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error
What Playwright (Python) does
One Python library drives Chromium, Firefox and WebKit through matching sync and async APIs, and the wider Playwright project now also offers an MCP server and a CLI that give AI agents accessibility snapshots instead of screenshots.
Playwright (Python) popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How Playwright (Python) is used
- Playwright (Python) is a dependency in 76 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (4.7% of the 1,623 Python ones), #5 of 141 in scraping, browsers and parsing.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 814; those are left out of every share on this page.
- The most used alternative in our scan is Selenium (27 projects).
- Projects that use it most often also use python-dotenv (64.5%), Uvicorn (52.6%), Pillow (44.7%).
- It is more common in projects set up for OpenClaw (4.8%) than for GitHub Copilot (0.8%).
By coding agent
Often used with
Playwright (Python) in practice
Strengths
The README example calls <code>launch()</code>, <code>new_page()</code>, <code>goto()</code> and <code>screenshot()</code> inside a loop over Chromium, Firefox and WebKit. It saves one screenshot per engine, named with <code>browser_type.name</code>.
The README shows the example twice. The second version uses <code>async_playwright()</code>, awaits each browser call and runs under <code>asyncio.run(main())</code>.
The site says actions wait until elements are actionable and that assertions retry until their conditions are met. The maintainers sum this up as "No artificial timeouts, no flaky tests."
The site describes the Trace Viewer as a full timeline of a test run. It shows DOM snapshots, network requests, console logs and screenshots "at every step", so you can investigate failures without re-running.
Watch out for
The Python site's front page gives install commands such as <code>npm init playwright@latest</code> and <code>npm i -g @playwright/cli@latest</code>. It names locators <code>getByRole</code> and <code>getByLabel</code>, while the Python release notes write <code>get_by_role</code>.
The v1.63.0 release notes announce that Ubuntu 20.04 is not supported anymore.
<code>frame_locator()</code> called with no selector searches every frame in the subtree. The rest of the locator then resolves inside a single frame, and the release notes say "an error is thrown when it matches elements in several frames."
Screenshot a page in all three engines
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
for browser_type in [p.chromium, p.firefox, p.webkit]:
browser = browser_type.launch()
page = browser.new_page()
page.goto('http://playwright.dev')
page.screenshot(path=f'example-{browser_type.name}.png')
browser.close()More about Playwright (Python)
Agent Skills for it
- : Skills, MCP servers, Custom Agents, Agents.md for SDKs to ground Coding Agents
- : A refined collection of Hypervelocity Engineering components (instructions, prompts, agents, and skills) to start your project off right, or
- : CLI for common Playwright actions. Record and generate Playwright code, inspect selectors and take screenshots.
- playwright-recording: Record browser interactions as video using Playwright. Use for capturing demo videos, app walkthroughs, and UI flows for Remotion videos. Tr
- playwright-interactive: Persistent browser and Electron interaction through `js_repl` for fast iterative UI debugging.
- playwright-expert: Use when writing E2E tests with Playwright, setting up test infrastructure, or debugging flaky browser tests. Invoke to write test scripts,
Packages around it
- python-dotenv: Env vars from .env
- pydantic: Data validation
- requests: HTTP client
- uvicorn: ASGI server
- pillow: Image processing
- fastapi: Web API framework
More in Scraping, browsers and parsing
Alternatives
Playwright (Python) This page
Official Python bindings for browser automation and web scraping.
Get started
Install it.
pip install playwrightRules for your agent
## Playwright (Python)
- For blocking code, follow the README: `from playwright.sync_api import sync_playwright` and `with sync_playwright() as p:`. For asyncio, use `async with async_playwright() as p:` and `await` the browser calls (`launch()`, `new_page()`, `goto()`, `screenshot()`, `close()`), run via `asyncio.run(main())`.
- Take Python syntax from the Python docs (https://playwright.dev/python/docs/intro) and API reference (https://playwright.dev/python/docs/api/class-playwright), e.g. `page.frame_locator().get_by_role("button").click()`. Do not copy the `getByRole`-style names or npm commands shown on the landing page.
- To filter to visible elements, use `locator.visible` (e.g. `page.locator("button").visible.click()`). The release notes call it the recommended replacement for the `:visible` CSS pseudo-class.
- To reach an element in an iframe without locating the iframe first, call `page.frame_locator()` with no selector. Make the rest of the locator specific enough to match in only one frame, or it throws.
- To record an aria snapshot and a screenshot on every action, start tracing with `context.tracing.start(snapshots=True, aria_snapshots=True, screen_snapshots=True)`.
- `http_credentials` accepts an array. The first entry matching the request origin is used, and an entry without an origin matches any request. Use `playwright codegen --http-credentials` to record against pages behind HTTP authentication.
AgentGid articles about Playwright (Python)
Teardown: A Claude Code Skill That Builds 3D Machine Simulators
A viral X article shows teardown, a free Claude Code skill that builds a machine as a 3D simulator in one offline HTML page and records it to video. We checked the repository: MIT, three working examples, what setup really needs and which claims hold up.
Claude Code Skills for Video and Animation: 8 GitHub Repos
A Chinese list of 8 Claude Code skills for video and animation, checked on GitHub: all were created in October 2026, one is not a skill at all, one needs paid DaVinci Resolve Studio under a non-commercial licence, and two lean on paid voice or image services.
Web Scraping: 10 GitHub Repos
A viral post lists 10 GitHub repos for web scraping. We checked each: license, language, releases, which ones AI-built projects use, why its Beautiful Soup link is not the official project, and Browserless's license.