Skip to main content

Undetected Python version of the Playwright testing and automation library.

Project description

🎭 Patchright Python


Patchright Version GitHub Downloads (all assets, all releases)

Patchright is a patched and undetected version of the Playwright Testing and Automation Framework.
It can be used as a drop-in replacement for Playwright.

[!NOTE]
This repository serves the Patchright-Python Package. To use Patchright with NodeJS, check out the NodeJS Package. Also check out the main Patchright Driver Repository


Sponsors

Hyperbrowser Banner Ad
If you’re looking for a high-performance browser automation platform checkout Hyperbrowser. It’s ideal for AI Agents, large-scale web scraping and automated testing.
Hyperbrowser delivers cloud-based browser infrastructure that scales instantly from a few sessions to thousands, with built-in CAPTCHA solving, stealth fingerprinting, and a global proxy network. It integrates seamlessly with Puppeteer, Playwright, and Selenium, so you can be up and running in minutes, no server or proxy management required.

Key Features:

  • Instant scaling: Launch 1,000+ concurrent browsers
  • Captcha Solving: Handles reCAPTCHA, Cloudflare, AWS, and more
  • Stealth mode: Dynamic, human-like fingerprints for undetectable automation
  • Global proxy network: 170+ countries with rotation and geo-targeting
  • Built-in debugging: Live view and session replay for real-time monitoring
  • 1-line integration: Works with Puppeteer, Playwright, Selenium in Node.js or Python

👉 Learn more at hyperbrowser.ai


Install it from PyPI

# Install Patchright with Pip from PyPI
pip install patchright
# Install Chromium-Driver for Patchright
patchright install chromium

Usage

Just change the import and use it like playwright. Patchright is a drop-in-replacement for Playwright!

[!IMPORTANT]
Patchright only patches CHROMIUM based browsers. Firefox and Webkit are not supported.

# patchright here!
from patchright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_page()
    page.goto('http://playwright.dev')
    page.screenshot(path=f'example-{p.chromium.name}.png')
    browser.close()
import asyncio
# patchright here!
from patchright.async_api import async_playwright

async def main():
    async with async_playwright() as p:
        browser = await p.chromium.launch()
        page = await browser.new_page()
        await page.goto('http://playwright.dev')
        await page.screenshot(path=f'example-{p.chromium.name}.png')
        await browser.close()

asyncio.run(main())

Best Practice - use Chrome without Fingerprint Injection

To be completely undetected, use the following configuration:

playwright.chromium.launch_persistent_context(
    user_data_dir="...",
    channel="chrome",
    headless=False,
    no_viewport=True,
    # do NOT add custom browser headers or user_agent
    ...
)

[!NOTE]
We recommend using Google Chrome instead of Chromium. You can install it via patchright install chrome (or via any other installation method) and use it with channel="chrome".


Patches

Runtime.enable Leak

This is the biggest Patch Patchright uses. To avoid detection by this leak, patchright avoids using Runtime.enable by executing Javascript in (isolated) ExecutionContexts.

Console.enable Leak

Patchright patches this leak by disabling the Console API all together. This means, console functionality will not work in Patchright. If you really need the console, you might be better off using Javascript loggers, although they also can be easily detected.

Command Flags Leaks

Patchright tweaks the Playwright Default Args to avoid detection by Command Flag Leaks. This (most importantly) affects:

  • --disable-blink-features=AutomationControlled (added) to avoid navigator.webdriver detection.
  • --enable-automation (removed) to avoid navigator.webdriver detection.
  • --disable-popup-blocking (removed) to avoid popup crashing.
  • --disable-component-update (removed) to avoid detection as a Stealth Driver.
  • --disable-default-apps (removed) to enable default apps.
  • --disable-extensions (removed) to enable extensions

General Leaks

Patchright patches some general leaks in the Playwright codebase. This mainly includes poor setups and obvious detection points.

Closed Shadow Roots

Patchright is able to interact with elements in Closed Shadow Roots. Just use normal locators and Patchright will do the rest.
Patchright is now also able to use XPaths in Closed Shadow Roots.


Stealth

With the right setup, Patchright currently is considered undetectable. Patchright passes:


Documentation and API Reference

See the original Playwright Documentation and API Reference

Extended Patchright API

evaluate Method (Frame.evaluate, Page.evaluate, Locator.evaluate, Worker.evaluate, JSHandle.evaluate)

  • Added isolated_context to choose Execution Context (Main/Isolated). Bool (optional, Defaults to True)
object.evaluate(
    expression: str,
    arg: typing.Optional[typing.Any] = None,
    ...,
+   isolated_context: typing.Optional[bool] = True
)

evaluate_handle Method (Frame.evaluate_handle, Page.evaluate_handle, Locator.evaluate_handle, Worker.evaluate_handle, JSHandle.evaluate)

  • Added isolated_context to choose Execution Context (Main/Isolated). Bool (optional, Defaults to True)
object.evaluate_handle(
    expression: str,
    arg: typing.Optional[typing.Any] = None,
    ...,
+   isolated_context: typing.Optional[bool] = True
)

evaluate_all Method (Locator.evaluate_all)

  • Added isolated_context to choose Execution Context (Main/Isolated). Bool (optional, Defaults to True)
Locator.evaluate_all(
    expression: str,
    arg: typing.Optional[typing.Any] = None,
    ...,
+   isolated_context: typing.Optional[bool] = True
)

Bugs

The bugs are documented in the Patchright Driver Repository.


TODO

The TODO is documented in the Patchright Driver Repository.


Development

Deployment of new Patchright versions are automatic, but bugs due to Playwright codebase changes may occur. Fixes for these bugs might take a few days to be released.


Support our work

If you choose to support our work, please contact @vinyzu or @steve_abcdef on Discord.


Copyright and License

© Vinyzu

Patchright is licensed Apache 2.0


Disclaimer

This repository is provided for educational purposes only.
No warranties are provided regarding accuracy, completeness, or suitability for any purpose. Use at your own risk—the authors and maintainers assume no liability for any damages, legal issues, or warranty breaches resulting from use, modification, or distribution of this code.
Any misuse or legal violations are the sole responsibility of the user.


Authors

Active Maintainer: Vinyzu
Co-Maintainer: Kaliiiiiiiiii

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

patchright-1.55.1-py3-none-win_arm64.whl (31.2 MB view details)

Uploaded Python 3Windows ARM64

patchright-1.55.1-py3-none-win_amd64.whl (35.5 MB view details)

Uploaded Python 3Windows x86-64

patchright-1.55.1-py3-none-win32.whl (35.5 MB view details)

Uploaded Python 3Windows x86

patchright-1.55.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (45.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

patchright-1.55.1-py3-none-manylinux1_x86_64.whl (45.9 MB view details)

Uploaded Python 3

patchright-1.55.1-py3-none-macosx_11_0_universal2.whl (40.4 MB view details)

Uploaded Python 3macOS 11.0+ universal2 (ARM64, x86-64)

patchright-1.55.1-py3-none-macosx_11_0_arm64.whl (38.7 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

patchright-1.55.1-py3-none-macosx_10_13_x86_64.whl (40.4 MB view details)

Uploaded Python 3macOS 10.13+ x86-64

File details

Details for the file patchright-1.55.1-py3-none-win_arm64.whl.

File metadata

  • Download URL: patchright-1.55.1-py3-none-win_arm64.whl
  • Upload date:
  • Size: 31.2 MB
  • Tags: Python 3, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for patchright-1.55.1-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 7a21612f3de3f266d651e603134eae9437c76a12999e0e526a9c3bfd64ede620
MD5 9929e84070fa98e80abff6b2957f5a5c
BLAKE2b-256 4af9f74fc93b2e71953743253f7d8f580627f220014e953024408668d5401dbd

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright-1.55.1-py3-none-win_arm64.whl:

Publisher: patchright_workflow.yml on Kaliiiiiiiiii-Vinyzu/patchright-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file patchright-1.55.1-py3-none-win_amd64.whl.

File metadata

  • Download URL: patchright-1.55.1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 35.5 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for patchright-1.55.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 cd7e20d0907dc2e4e3caeea79a45e2ed8fef37408c63155c05e79952cd32a23a
MD5 3c3a35e5e31488b462c6d8bf86da811a
BLAKE2b-256 0883e69d5d97d5174321dbe0e06518a8c7bb407a273d1525cf0e82f667d57d91

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright-1.55.1-py3-none-win_amd64.whl:

Publisher: patchright_workflow.yml on Kaliiiiiiiiii-Vinyzu/patchright-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file patchright-1.55.1-py3-none-win32.whl.

File metadata

  • Download URL: patchright-1.55.1-py3-none-win32.whl
  • Upload date:
  • Size: 35.5 MB
  • Tags: Python 3, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for patchright-1.55.1-py3-none-win32.whl
Algorithm Hash digest
SHA256 5122fdfcaaf300d4171fb437b0748073f415591d9934800c1983cb6decea4c45
MD5 ccc2540e2c0d26134e64246ad2e89f2e
BLAKE2b-256 59b4662157dbcb17b3e14d34001f21fff4483e48bb190863463a5359cdc5403c

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright-1.55.1-py3-none-win32.whl:

Publisher: patchright_workflow.yml on Kaliiiiiiiiii-Vinyzu/patchright-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file patchright-1.55.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for patchright-1.55.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a7eeb5a3e7daac9ffb37d94bb18d2cf56a7e082c9cf152e921cf7fc78af66006
MD5 97e2d1e78a9e9d43a776fb5ee467b81a
BLAKE2b-256 07c68bc7b996d4db7543a5c8ad6fa304eecc638153a7599c2c05a7d321eb9753

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright-1.55.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: patchright_workflow.yml on Kaliiiiiiiiii-Vinyzu/patchright-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file patchright-1.55.1-py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for patchright-1.55.1-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 51806ad3aa1288b4e670149881e3997dc75f95d651e3b87b480c6ae3d5e80f1d
MD5 12d3d2544dbf8ce37c59efacf8d98cf2
BLAKE2b-256 bae4aecbca2c055c4801805b59c5098908bf2b6596eb2e0dc01985fdbf78e7b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright-1.55.1-py3-none-manylinux1_x86_64.whl:

Publisher: patchright_workflow.yml on Kaliiiiiiiiii-Vinyzu/patchright-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file patchright-1.55.1-py3-none-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for patchright-1.55.1-py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 c72a6434eb1e62aa21cab2c73707b07b67bd2d1462ba7478a2c3a9bb7ebb56af
MD5 a296208661e3f3547a0c650cc475bc05
BLAKE2b-256 a7c494f9c8c692ecafe66373aebb79e76996bb13c5167db8c05276699de89ac6

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright-1.55.1-py3-none-macosx_11_0_universal2.whl:

Publisher: patchright_workflow.yml on Kaliiiiiiiiii-Vinyzu/patchright-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file patchright-1.55.1-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for patchright-1.55.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 773f581b697149d2a7bb62f2e82c4416d212f1c5547449200c36d2f519ce1a68
MD5 0954f16732202ede00c3f08268cc1952
BLAKE2b-256 73d835d63958acade6c6f3201a4c7b27e0d9ead28c53deb7d70213f3efccecc5

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright-1.55.1-py3-none-macosx_11_0_arm64.whl:

Publisher: patchright_workflow.yml on Kaliiiiiiiiii-Vinyzu/patchright-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file patchright-1.55.1-py3-none-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for patchright-1.55.1-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 343b31ba2c2078b3b3ae86dd2f955dd7a5c3baa0c23bb743e5fc1915b5160ebf
MD5 2a8be2afc79025a6cc775b16df71b66f
BLAKE2b-256 ac0b21433f47629dda4b0ff0abaf78564ac2fcfdf995681d9b49474da8bef5af

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright-1.55.1-py3-none-macosx_10_13_x86_64.whl:

Publisher: patchright_workflow.yml on Kaliiiiiiiiii-Vinyzu/patchright-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page