Registry / testing / install-playwright

install-playwright

JSON →
library1.0.1pypypi✓ verified 85d ago

install-playwright is a Python library that provides a programmatic way to execute the `playwright install` CLI command, which downloads browser binaries (Chromium, Firefox, WebKit) required by the Playwright automation library. This allows Python applications to manage Playwright browser installations directly, without needing to shell out to a subprocess. The current version is 1.0.0, and it follows an infrequent release cadence, primarily updating for compatibility or minor feature additions.

pip install install-playwright
INSTALL
IMPORT
SIG · INSTALL-PLAYWRIGHT
I
install-playwright
testingpythonv1.0.1
Install
3.3s avg
Import
115ms
Disk
323MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.940 runs
build_error
glibc
py 3.103.940 runs
installs and imports cleanly · install 3.3s · import 0.115s · 323MB
323MB installed
● package 323MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

install
from install_playwright import install
This imports the function to trigger browser installation.
sync_playwright
from playwright.sync_api import sync_playwright
Necessary to get browser type objects (e.g., p.chromium) which are passed to install_playwright.install.

This quickstart demonstrates how to use `install_playwright` to programmatically install Playwright browser binaries. It first imports `sync_playwright` from the main `playwright` library to access browser type objects, then calls `install()` with the desired browser types. After installation, it includes a simple Playwright usage example to verify successful setup.

from playwright.sync_api import sync_playwright from install_playwright import install with sync_playwright() as p: # Install Chromium browser binaries print("Installing Chromium...") install([p.chromium]) print("Chromium installed.") # Optionally, install other browsers # print("Installing Firefox and WebKit...") # install([p.firefox, p.webkit]) # print("Firefox and WebKit installed.") # Example of using Playwright after installation browser = p.chromium.launch() page = browser.new_page() page.goto("http://example.com") print(f"Page title: {page.title()}") browser.close()
Debug
Known issues
gotchaThe `install-playwright` library only handles the *installation of browser binaries* (Chromium, Firefox, WebKit). It does NOT install the `playwright` Python package itself. You must `pip install playwright` separately.
fix
Ensure both `pip install playwright` and `pip install install-playwright` are run. Always install `playwright` first.
affects: All versions
gotchaThe `install` function expects `BrowserType` objects from the `playwright` library (e.g., `p.chromium`). You must initialize `playwright.sync_api.sync_playwright` or `playwright.async_api.async_playwright` to obtain these objects before calling `install_playwright.install`.
fix
Use a `with sync_playwright() as p:` block (for synchronous usage) or `async with async_playwright() as p:` (for asynchronous usage) and pass `p.chromium`, `p.firefox`, or `p.webkit` to the `install` function.
affects: All versions
gotchaBy default, `install_playwright.install()` will install all supported browsers if called without arguments, similar to `playwright install`. To install specific browsers, you must pass a list of `BrowserType` objects.
fix
To install only Chromium, use `install([p.chromium])`. To install multiple specific browsers, use `install([p.chromium, p.firefox])`.
affects: All versions
Errors
Common errors & fixes
NameError: name 'p' is not defined
The `p` object (representing the Playwright context) was not initialized or is out of scope when calling `install_playwright.install([p.chromium])`.
fix
Wrap your `install` call within a `with sync_playwright() as p:` block or ensure `p` is available from an `async_playwright` context.
ModuleNotFoundError: No module named 'playwright'
The main `playwright` Python library has not been installed, which is a prerequisite for `install-playwright` and for providing the `BrowserType` objects.
fix
Run `pip install playwright` before installing `install-playwright` or attempting to use it.
TypeError: 'BrowserType' object is not iterable
The `install` function expects a list of `BrowserType` objects, but a single `BrowserType` object was passed directly without being wrapped in a list.
fix
Ensure you pass a list to the `install` function, even if it contains only one browser, e.g., `install([p.chromium])` instead of `install(p.chromium)`.
Upgrade
Version history
1.0.1latest on PyPI · released Apr 25, 2026
Audit
Dependencies
playwrightrequiredinstall-playwright is a wrapper around the Playwright CLI's `install` command, thus the Playwright library itself must be installed to provide the necessary BrowserType objects (p.chromium, etc.) and underlying CLI functionality.
Agent activity
20 hits · last 30 days
node
18
Resources