Lightweight CDP-first browser automation; users are responsible for lawful authorized use.
Project description
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_geckodriverwrapper
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.ymlprojects/playwrong/.github/workflows/publish-pypi.yml
Publish flow is configured for trusted publishing with pypa/gh-action-pypi-publish.
Recommended release process:
- Push/tag a release (
vX.Y.Z) and publish a GitHub Release. - Ensure repository environment
pypiexists and is approved for publishing. - 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 returns405onGET /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
playwrongdo 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file playwrong-0.1.0.tar.gz.
File metadata
- Download URL: playwrong-0.1.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
736f50ca6122e9e4fed3a1d53d41bad9efe6b28d4e437ee528931c887448bf51
|
|
| MD5 |
7771932daeb652257afee22873ba5a2a
|
|
| BLAKE2b-256 |
be0ae1c2dd8e37d3d99da8ea2a485eae936eb9c0fbc551a6caf60d3f235abfae
|
Provenance
The following attestation bundles were made for playwrong-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on lramos0/playwrong
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
playwrong-0.1.0.tar.gz -
Subject digest:
736f50ca6122e9e4fed3a1d53d41bad9efe6b28d4e437ee528931c887448bf51 - Sigstore transparency entry: 1440375061
- Sigstore integration time:
-
Permalink:
lramos0/playwrong@4e2451af7650005e6090188b9d1c22f04e45e060 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/lramos0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@4e2451af7650005e6090188b9d1c22f04e45e060 -
Trigger Event:
push
-
Statement type:
File details
Details for the file playwrong-0.1.0-py3-none-any.whl.
File metadata
- Download URL: playwrong-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
404c808ee91cf4c7e86efd267440312fb3aba349ff1b7ca9b9e67a26a4ee9750
|
|
| MD5 |
66769b2cc9688d35c07dc022a97c430b
|
|
| BLAKE2b-256 |
7d733b1418319c79f12e5aae9afa6566e1a86dd026a03243c77a84f03da9f067
|
Provenance
The following attestation bundles were made for playwrong-0.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on lramos0/playwrong
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
playwrong-0.1.0-py3-none-any.whl -
Subject digest:
404c808ee91cf4c7e86efd267440312fb3aba349ff1b7ca9b9e67a26a4ee9750 - Sigstore transparency entry: 1440375066
- Sigstore integration time:
-
Permalink:
lramos0/playwrong@4e2451af7650005e6090188b9d1c22f04e45e060 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/lramos0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@4e2451af7650005e6090188b9d1c22f04e45e060 -
Trigger Event:
push
-
Statement type: