Skip to main content

playwrong

playwrong is a lightweight browser automation library with a Playwright-like sync/async surface.

If you are an AI coding assistant working on this package, read ai_agent.md first.

It is focused on practical scraping workflows:

  • wrap headful crawling around an already-existing browser instance when available
  • attach to an already-open Chromium/Edge CDP endpoint when possible
  • launch a new debug browser if no endpoint is available
  • provide a small, familiar API (sync_playwright, chromium.launch, connect_over_cdp, new_page, goto, content)
  • optional Firefox backend via Selenium + local undetected_geckodriver wrapper

Primary intent: allow operators to inject an already-running browser into headful crawling so automation can reuse an established session (cookies/auth state) instead of starting from a cold profile every run.

This way you can still get served relevant ads while automating your browser hehe.

Status

Early alpha (0.x). API may evolve.

Install

python -m pip install -e .

Publishing to PyPI

This package includes GitHub Actions pipelines for build/test and publish:

  • projects/playwrong/.github/workflows/ci.yml
  • projects/playwrong/.github/workflows/publish-pypi.yml

Publish flow is configured for trusted publishing with pypa/gh-action-pypi-publish.

Recommended release process:

  1. Push/tag a release (vX.Y.Z) and publish a GitHub Release.
  2. Ensure repository environment pypi exists and is approved for publishing.
  3. Configure PyPI trusted publisher for your GitHub repository/workflow.

Quick start

from playwrong.sync_api import sync_playwright

with sync_playwright(verbose=True) as p:
    browser = p.chromium.connect_over_cdp("http://127.0.0.1:9222")
    page = browser.new_page()
    page.goto("https://example.com", wait_until="load")
    html = page.content()
    browser.close()

Open-browser attach

Start Edge/Chrome with remote debugging first, for example:

& "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --remote-debugging-port=9222 --user-data-dir="$env:TEMP\edge-cdp-profile" about:blank

Then connect:

browser = p.chromium.connect_over_cdp("http://127.0.0.1:9222")

API surface

  • sync_playwright(...)
  • async_playwright(...)
  • p.chromium.launch(...)
  • p.chromium.connect_over_cdp(endpoint)
  • p.firefox.launch(...)
  • browser.new_context(...)
  • browser.new_page()
  • page.goto(url, wait_until="load", timeout=...)
  • page.content()
  • browser.close()

Environment variables

  • PLAYWRONG_PREFER_OPEN (true/false)
  • PLAYWRONG_CDP_ENDPOINTS (comma-separated URLs)
  • PLAYWRONG_CDP_TIMEOUT_SECONDS (float)
  • PLAYWRONG_VERBOSE (true/false)

Notes

  • Edge-compatible target creation uses PUT /json/new?url=... because modern Edge returns 405 on GET /json/new.
  • Firefox attach-to-existing-session is not supported; Firefox launches a new WebDriver session.
  • This package intentionally exposes a minimal subset rather than full Playwright parity.

Legal Responsibility

This library is distributed as a general-purpose automation toolkit.

  • The maintainers/publishers of playwrong do not grant permission to access any specific website, service, or data source.
  • Compliance with laws, contracts, robots policies, terms of service, and internal security/privacy requirements is solely the responsibility of the user/operator.
  • Users are responsible for obtaining any required authorization before automating browser actions.
  • The software is provided under the project license on an "AS IS" basis, without legal or compliance warranties.

See SECURITY.md for reporting and security policy details.

Metadata

Release files for playwrong 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for playwrong 0.1.0
File Size Uploaded Provenance
playwrong-0.1.0.tar.gz 5.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for playwrong 0.1.0
File Interpreter ABI Platform
playwrong-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 kB

Release files / playwrong-0.1.0.tar.gz

Download URL playwrong-0.1.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
736f50ca6122e9e4fed3a1d53d41bad9efe6b28d4e437ee528931c887448bf51
BLAKE2b-256 checksum
How to use checksums
be0ae1c2dd8e37d3d99da8ea2a485eae936eb9c0fbc551a6caf60d3f235abfae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 5, 2026.

Transparency log

Release files / playwrong-0.1.0-py3-none-any.whl

Download URL playwrong-0.1.0-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
404c808ee91cf4c7e86efd267440312fb3aba349ff1b7ca9b9e67a26a4ee9750
BLAKE2b-256 checksum
How to use checksums
7d733b1418319c79f12e5aae9afa6566e1a86dd026a03243c77a84f03da9f067
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 5, 2026.

Transparency log

Security for playwrong 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for playwrong-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 5, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page