Playwright but bring your own browser
Project description
playwright-byob
Bring your own browser to Playwright.
playwright-byob is a tiny Python helper for launching Playwright against the real Google Chrome installation and profile already present on a machine. It keeps the API close to Playwright, but chooses practical defaults for headed, persistent Chrome automation.
Installation
pip install playwright-byob
With uv:
uv add playwright-byob
Quick start
from playwright.sync_api import sync_playwright
from playwright_byob import launch_chrome
with sync_playwright() as p:
context = launch_chrome(p)
page = context.new_page()
page.goto("https://example.com")
print(page.title())
context.close()
The default launch uses installed Chrome when detected, falls back to
Playwright's channel="chrome", opens headed, uses the platform Chrome user
data directory, selects the Default profile, disables Playwright's fixed
viewport, and removes the --enable-automation default argument.
Customize the browser or profile
from playwright.sync_api import sync_playwright
from playwright_byob import launch_chrome
with sync_playwright() as p:
context = launch_chrome(
p,
browser_path="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
user_data_dir="~/Library/Application Support/Google/Chrome",
profile_directory="Profile 1",
args=["--window-size=1440,1000"],
timeout=30_000,
)
You can also use environment variables:
PLAYWRIGHT_BYOB_CHROME_PATHPLAYWRIGHT_BYOB_USER_DATA_DIRPLAYWRIGHT_BYOB_PROFILE_DIRECTORY
Privacy note
A real Chrome profile can contain cookies, local storage, saved sessions, and other sensitive state, so use this intentionally. Tests in this project never read or launch a real user profile. They use temporary directories and fake Playwright objects.
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 playwright_byob-0.1.0.tar.gz.
File metadata
- Download URL: playwright_byob-0.1.0.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
249dc5b3286f97a08ff0d2aedbb8435a832774e0f656f2b30c8e895aba7283ca
|
|
| MD5 |
a4f6ddfbf4d8fa6ebc76dccc4334afe6
|
|
| BLAKE2b-256 |
6bad96b84b352af932eca9bc1ecc4b9e365359ab6d12e551f7c506e3f7cc1138
|
File details
Details for the file playwright_byob-0.1.0-py3-none-any.whl.
File metadata
- Download URL: playwright_byob-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d832eabcdc48a6377b80443900437d4f52ef84ab75b5fc29651bd610a83a5eb
|
|
| MD5 |
82670f2c238faf16a3f17d45ff1149a2
|
|
| BLAKE2b-256 |
f4cb5806d936e54b6f4f4a20b2a624107f4d2b66dbc5d952cd4aae547ecb873b
|