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

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

patchright_fork-1.56.2-py3-none-win_arm64.whl (31.2 MB view details)

Uploaded Python 3Windows ARM64

patchright_fork-1.56.2-py3-none-win_amd64.whl (35.6 MB view details)

Uploaded Python 3Windows x86-64

patchright_fork-1.56.2-py3-none-win32.whl (35.6 MB view details)

Uploaded Python 3Windows x86

patchright_fork-1.56.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (46.1 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

patchright_fork-1.56.2-py3-none-macosx_11_0_universal2.whl (40.6 MB view details)

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

patchright_fork-1.56.2-py3-none-macosx_11_0_arm64.whl (39.4 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

patchright_fork-1.56.2-py3-none-macosx_10_13_x86_64.whl (40.6 MB view details)

Uploaded Python 3macOS 10.13+ x86-64

File details

Details for the file patchright_fork-1.56.2-py3-none-win_arm64.whl.

File metadata

File hashes

Hashes for patchright_fork-1.56.2-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 ff2c69f178c75ce69ecfb903204608bd35654847f0de7110119134d445cb2354
MD5 1706490559fdd2235e12655c52910753
BLAKE2b-256 e46728a6c997c09143e1d3a0fcc6bd7aebb577ca7eba17f9a1f92864f43adfb7

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright_fork-1.56.2-py3-none-win_arm64.whl:

Publisher: patchright_workflow.yml on StudentWan/patchright-python-fork

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_fork-1.56.2-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for patchright_fork-1.56.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 84b54577e9868ed89018b385b10b478f040b90f851376b976547d4483898e615
MD5 96e9eab785420a126d22069f90ecc7f8
BLAKE2b-256 99164e07f8c29c125e85f76a25798487527d9cdf9c01fb68879527472d2d2239

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright_fork-1.56.2-py3-none-win_amd64.whl:

Publisher: patchright_workflow.yml on StudentWan/patchright-python-fork

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_fork-1.56.2-py3-none-win32.whl.

File metadata

File hashes

Hashes for patchright_fork-1.56.2-py3-none-win32.whl
Algorithm Hash digest
SHA256 1b38f1c8c53f2abfb8a83d4dd95f7a5d0946e6fbc7ab455f2281977c16e4eef9
MD5 bf5254401f33c05c8ae9c127de4b59b6
BLAKE2b-256 295a9d5d97e4b378ca210c04c09daacc5ecd21d0ced625b2904ee3d4909cb352

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright_fork-1.56.2-py3-none-win32.whl:

Publisher: patchright_workflow.yml on StudentWan/patchright-python-fork

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_fork-1.56.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for patchright_fork-1.56.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d4625f3a4a2da07ce8d90550bdaa0095ce7a398ab232cd12b34d9ba5eb86b1c6
MD5 0c533cab5ffce0e752d45bae2d706730
BLAKE2b-256 2436ecb3a63ba9d9323b78e2511a732392e9db6bca0846aec365e0a2bebab22c

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright_fork-1.56.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: patchright_workflow.yml on StudentWan/patchright-python-fork

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_fork-1.56.2-py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for patchright_fork-1.56.2-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8761c798e7d301329495a337ff90897e5a4d0e93bbfcd686b1f40ed900adf766
MD5 c96cfba76e8f040632754b84274184b1
BLAKE2b-256 505c647e0c4741d571f240ecd890c8f4932bc6c42092569891dba728bf299144

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright_fork-1.56.2-py3-none-manylinux1_x86_64.whl:

Publisher: patchright_workflow.yml on StudentWan/patchright-python-fork

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_fork-1.56.2-py3-none-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for patchright_fork-1.56.2-py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 16ad19f421535501d6dcb695f95bb3cffab54a1c9839c4039428b92de552e833
MD5 f3c45fe24f898989d448389ab6e84774
BLAKE2b-256 bdb37648bc3d2a26ab7aabc359c58d58bb012d9d955190d7d047afb02809a106

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright_fork-1.56.2-py3-none-macosx_11_0_universal2.whl:

Publisher: patchright_workflow.yml on StudentWan/patchright-python-fork

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_fork-1.56.2-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for patchright_fork-1.56.2-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 422c278e384fb811929e18ff0b4d72d1ca3b895e06bc4081db47bc33809685b3
MD5 fb670fa1cb78d0254b1c275592267429
BLAKE2b-256 7ac432c402d307599665e614d1559554acde53931799cba6bf751a12c5419350

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright_fork-1.56.2-py3-none-macosx_11_0_arm64.whl:

Publisher: patchright_workflow.yml on StudentWan/patchright-python-fork

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_fork-1.56.2-py3-none-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for patchright_fork-1.56.2-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 a97c76c2de283013203d012502be358978d16689bd837e459f5565a39c346b5d
MD5 a4abdab561a54a2b43ea0c9c39b41a91
BLAKE2b-256 fd40f67e85710b70248ca7d54b8e1a5408124fca1e31a44d02fbaa5043fa349c

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright_fork-1.56.2-py3-none-macosx_10_13_x86_64.whl:

Publisher: patchright_workflow.yml on StudentWan/patchright-python-fork

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