# invisible_playwright

> A Python library that keeps Playwright's sync and async API but launches a Firefox patched at the C++ level, with a seed-derived fingerprint and humanized mouse input

- Category: Agents & Automation / Computer & Browser Use
- Language: Python
- Licence: MIT
- Repository: https://github.com/feder-cr/invisible_playwright
- Canonical page: https://ai-tldr.dev/tools/invisible-playwright/
- Updated: 2026-10-13

## In short

invisible_playwright is a Python library for web scraping and browser automation that keeps Playwright's API and swaps the browser underneath. It sits in the Computer & Browser Use category of the Agents & Automation tools and is open-source, written in Python and licensed MIT. To get started: install the library and fetch the engine.

## Overview

invisible_playwright is a Python library for web scraping and browser automation that keeps Playwright's API and swaps the browser underneath. Instead of `p.firefox.launch()`, you open `InvisiblePlaywright()` as a context manager, and what you get back is an ordinary `playwright.sync_api.Browser` (or the async equivalent) — the same objects, calls and return values, so existing Playwright code runs as-is after a two-line change. The browser it launches is Firefox patched at the C++ source level, downloaded once with `python -m invisible_playwright fetch` and verified by sha256.

The project frames bot detection as two questions — is this a real browser, and is a real person using it — and answers each in a different layer. The fingerprint (navigator, screen, GPU/WebGL, canvas, fonts, audio, WebRTC, timezone, network) is set inside the engine from a single profile rather than injected into the page, so there is no JavaScript shim for a page to find and no two surfaces that disagree, headless or headed. The driver humanizes input: clicks, hovers and drags follow a Bezier-curve mouse path with human timing, and input events come through the real input path, so the page sees trusted events.

Every session gets a distinct fingerprint of roughly 200 fields unless you pass a `seed`, which reproduces the same GPU, canvas hash and audio context on every run; individual fields can be pinned while the rest stays seed-derived. Proxies accept `socks5`, `socks4`, `http` and `https`, with DNS routed through the proxy and the timezone derived from the egress IP unless you set one explicitly. A few Playwright surfaces are deliberately out of scope — tracing, HAR, CDP and the API request context — and each refuses with an explanation rather than misbehaving quietly. The README points readers who would rather prompt than script to an MCP server and a chat interface built on the same engine.

The wrapper is MIT licensed; the patched Firefox binary is distributed under MPL-2.0, and the C++ patches that produce it are published in a separate repository, feder-cr/firefox_antidetect_patch. It needs Python 3.11 or newer and runs on Windows x86_64 and Linux x86_64 / arm64. The repository also carries an extensive documentation set: guides on how detection works, write-ups of named anti-bot products, and comparisons with Camoufox, Patchright, nodriver and playwright-stealth.

## What it does

- Playwright's own sync and async API — the returned `browser` is a standard Playwright `Browser`, so switching from `sync_playwright()` is two lines
- A Firefox engine patched in C++: navigator, screen, WebGL, canvas, fonts, audio, WebRTC and timezone are decided inside the browser from one profile, with no page-visible JavaScript shim
- Humanized input in the driver — Bezier-curve mouse paths with human timing and trusted events from the real input path
- Reproducible identities: a `seed` fixes the whole fingerprint, and `pin` forces chosen fields (GPU persona, screen size, hardware concurrency) while the rest stays seed-derived
- Proxy support for socks5, socks4, http and https with DNS through the proxy, a WebRTC candidate carrying the proxy exit, and a timezone derived from the egress IP
- A small CLI (`invisible-playwright fetch` / `version`) that downloads the engine, checks cached copies against their seal and reports wrapper, core and engine versions

## Getting started

Install the package from PyPI, then fetch the patched Firefox once. The download is sha256-verified and runs about 240 MB on Windows and 253–262 MB on Linux (around 550 MB unpacked). Python 3.11 or newer is required.

1. Install the library and fetch the engine

```bash
pip install invisible-playwright
python -m invisible_playwright fetch
```

2. Switch an existing Playwright script

   Replace the import and the launch; everything after that is unchanged Playwright code.

```diff
- from playwright.sync_api import sync_playwright
- with sync_playwright() as p:
-     browser = p.firefox.launch()
+ from invisible_playwright import InvisiblePlaywright
+ with InvisiblePlaywright() as browser:
```

3. Drive a page (sync or async)

   Each session gets its own fingerprint, and clicks travel to their target on a Bezier curve. The async version imports from `invisible_playwright.async_api` and awaits the same calls.

```python
from invisible_playwright import InvisiblePlaywright

with InvisiblePlaywright(proxy={"server": "socks5://...", "username": "u", "password": "p"}) as browser:
    page = browser.new_page()
    page.goto("https://example.com")
    page.click("#submit")   # mouse arcs to the button on a Bezier curve
```

4. Make a run reproducible

   Log the seed of a random session to replay it, or pass one explicitly to get the same GPU, canvas hash and audio context every run. Timezone follows the egress IP unless you name an IANA zone.

```python
with InvisiblePlaywright(seed=42) as browser:
    ...   # same GPU, same canvas hash, same audio context, every run

with InvisiblePlaywright(proxy=proxy, timezone="America/New_York") as browser:
    ...
```

5. Pin specific fingerprint fields

   A GPU pin selects one of the validated personas rather than setting a free string; an unknown renderer name raises and lists the ones available.

```python
with InvisiblePlaywright(
    seed=42,
    pin={
        "gpu.renderer": "ANGLE (AMD, Radeon R9 200 Series Direct3D11 vs_5_0 ps_5_0, D3D11)",
        "gpu.vendor":   "Google Inc. (AMD)",
        "screen.width":  2560,
        "screen.height": 1440,
        "hardware.concurrency": 16,
    },
) as browser:
    ...
```

## When to use it

- Reach for it when an existing Playwright scraper or automation script keeps hitting anti-bot challenges and you want to keep the code you have
- Reach for it when you need a stable, replayable browser identity across runs — the same seed, the same fingerprint
- Reach for it when traffic goes through a proxy and the browser's timezone, DNS and WebRTC address must agree with the exit
- Reach for it when you would rather write Python than prompts — the same engine is offered to agents through a separate MCP server

## Version history

- 2026-10-13 v0.35.7: Input events are now stamped a few milliseconds before the page sees them, as on real hardware, and the first enumerateDevices() call of a session takes a seed-fixed time on both Windows and Linux.
