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


Thordata Banner

Thordata - Your First Plan is on Us! 💰Get 100% of your first residential proxy purchase back as wallet balance, up to $900.

⚡ Why Thordata?

🌍 190+ real residential & ISP IP locations
🔐 Fully encrypted, ultra-secure connections
🚀 Optimized for web scraping, ad verification & automation workflows

🔥Don’t wait — this is your best time to start with Thordata and experience the safest, fastest proxy network.


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

If you're not sure about the file name format, learn more about wheel file names.

patchright-1.58.0-py3-none-win_arm64.whl (33.1 MB view details)

Uploaded Python 3Windows ARM64

patchright-1.58.0-py3-none-win_amd64.whl (36.8 MB view details)

Uploaded Python 3Windows x86-64

patchright-1.58.0-py3-none-win32.whl (36.8 MB view details)

Uploaded Python 3Windows x86

patchright-1.58.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (45.9 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

patchright-1.58.0-py3-none-manylinux1_x86_64.whl (46.2 MB view details)

Uploaded Python 3

patchright-1.58.0-py3-none-macosx_11_0_universal2.whl (42.2 MB view details)

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

patchright-1.58.0-py3-none-macosx_11_0_arm64.whl (41.0 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

patchright-1.58.0-py3-none-macosx_10_13_x86_64.whl (42.2 MB view details)

Uploaded Python 3macOS 10.13+ x86-64

File details

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

File metadata

  • Download URL: patchright-1.58.0-py3-none-win_arm64.whl
  • Upload date:
  • Size: 33.1 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.58.0-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 b044efea1774beac8ee033583eac7181b86ea450da3a36d3039d7a1a428ac098
MD5 a55cabdfbfd669751bdb7e8d738855a2
BLAKE2b-256 912a81ef2b079bbc925a935f2fd73dc1285c46c7eb35c5032a0d63b48d753c4a

See more details on using hashes here.

Provenance

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

Publisher: patchright_release.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.58.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: patchright-1.58.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 36.8 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.58.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 e37109834056feb8e4e4918fb259d497dbfc37e03f9391c0d3cf1532f5fa9b7f
MD5 ef3a5461aca5e2a7713374a0de7e3b57
BLAKE2b-256 d0a1b7dff0669ce8814c690c67eee1b44b3cdb422593efbbbbc4bfe3bf10f9fa

See more details on using hashes here.

Provenance

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

Publisher: patchright_release.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.58.0-py3-none-win32.whl.

File metadata

  • Download URL: patchright-1.58.0-py3-none-win32.whl
  • Upload date:
  • Size: 36.8 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.58.0-py3-none-win32.whl
Algorithm Hash digest
SHA256 5529f66d296e2894789c309a13750b1a20f468daeb7de511f91bbf54cac95d95
MD5 ffa7503a0a904280d7dee7fbb903aa03
BLAKE2b-256 4a11e21a51c42969473237c92a47d5433b2c58db1ec2bbd3b340ddeb33ac718f

See more details on using hashes here.

Provenance

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

Publisher: patchright_release.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.58.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for patchright-1.58.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 431b1df8967b4919d326a3121445c47f15769bc6a10dcebaa699073eb7d125f9
MD5 b7dda8c553489279dd4ab1c32425e4d3
BLAKE2b-256 b9b17094545c805a31235ef69316ccc910aa5ff5e940c41e85df588ca660f00d

See more details on using hashes here.

Provenance

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

Publisher: patchright_release.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.58.0-py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for patchright-1.58.0-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 832bee2fe48cf9dc07bb3b0f0d05eee923203f348cd98b14c2c515eece326734
MD5 81d91cf253c48e106532b4a63c70a137
BLAKE2b-256 ea8698d8f42d5186b6864144fb25e21da8aa7cffa5b9d1d76752276610b9ea58

See more details on using hashes here.

Provenance

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

Publisher: patchright_release.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.58.0-py3-none-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for patchright-1.58.0-py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 ccf8116a97dcef6e3865c9823f51965db069c931346afe5253e25d9486160a92
MD5 abf527580aaecc7d066621f97a539486
BLAKE2b-256 6c33db35661268edc03381bbf61dcb3119f427591562ce45dce90d17e116ffb5

See more details on using hashes here.

Provenance

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

Publisher: patchright_release.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.58.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for patchright-1.58.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 af567d94d2d735be8fa88c6ff9418e46361d823f7b28c10c2823e51942739507
MD5 c95f8387098be03b285ce9ad25b6a1a9
BLAKE2b-256 6113e5726d38be9ecf9ed714346433f2536eb6423748836f4a22a6701b992ba0

See more details on using hashes here.

Provenance

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

Publisher: patchright_release.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.58.0-py3-none-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for patchright-1.58.0-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 caadeec5b4812f12db5e245e78b7c1bdd9c6b38d2c15a59fa3047b04e33a3e60
MD5 cbebadcf348dab100401602637c01d43
BLAKE2b-256 61c6b1d685ccce237e280d8549454a8b5760e58ab5ee88af9ef875fad2282845

See more details on using hashes here.

Provenance

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

Publisher: patchright_release.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 Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page