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


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!

[!WARNING]
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 Practices

To be completely undetected, use the following configuration:

playwright.chromium.launch_persistent_context(
    user_data_dir="...",
    channel="chrome",
    headless=False,
    no_viewport=True,
    ...
)

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.


Stealth

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


Documentation and API Reference

See the original Playwright Documentation and API Reference


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.49.1-py3-none-win_amd64.whl (34.0 MB view details)

Uploaded Python 3 Windows x86-64

patchright-1.49.1-py3-none-win32.whl (34.0 MB view details)

Uploaded Python 3 Windows x86

patchright-1.49.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (43.7 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ARM64

patchright-1.49.1-py3-none-manylinux1_x86_64.whl (44.1 MB view details)

Uploaded Python 3

patchright-1.49.1-py3-none-macosx_11_0_universal2.whl (39.5 MB view details)

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

patchright-1.49.1-py3-none-macosx_11_0_arm64.whl (38.8 MB view details)

Uploaded Python 3 macOS 11.0+ ARM64

patchright-1.49.1-py3-none-macosx_10_13_x86_64.whl (39.5 MB view details)

Uploaded Python 3 macOS 10.13+ x86-64

File details

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

File metadata

File hashes

Hashes for patchright-1.49.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 075aae12c89bf44b95f4d7aa50147c0a7efde98909520754f0a81ec1478bacb9
MD5 f0366c9cfedfa798a4b312e73370c464
BLAKE2b-256 1a709250d227e751be1487399a3b8d98d502ceba54fd3a825eee87a641475e90

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright-1.49.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.49.1-py3-none-win32.whl.

File metadata

  • Download URL: patchright-1.49.1-py3-none-win32.whl
  • Upload date:
  • Size: 34.0 MB
  • Tags: Python 3, Windows x86
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for patchright-1.49.1-py3-none-win32.whl
Algorithm Hash digest
SHA256 3e050b9c404acedc584b4bfc8b63103694150c088c02a99ff352f40d4f8f8980
MD5 9804283a2cdfbfd748babeb6404c4878
BLAKE2b-256 9fa594ee9849d059c92565ca0d4bffdb2ea7a633896f388edf0608b9dde7dfa0

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright-1.49.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.49.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for patchright-1.49.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ef08a69baa21f23706afebe7cc725d79136aa20a9eafeae33d8f2c67b3f5dd0f
MD5 7c744d55289cf756e2c7c09cb8ed97db
BLAKE2b-256 50aa8de213d2e6d11c0081c8275708eb4f05b29a664d864453b6133e77d1c652

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright-1.49.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.49.1-py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for patchright-1.49.1-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b1ec8aff4254d8f6faecd582a4d224a626da052528023f041f027ee3117650df
MD5 d60be7e1c7c628178de8b29152f6afe1
BLAKE2b-256 fc024f9700308d2f855b6133fae230b9493e1c2015a8778d74cc19a8be573bc0

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright-1.49.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.49.1-py3-none-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for patchright-1.49.1-py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 41b82c3783f1a4de4a42d2879aaeb740a9c7e19fa7c2618c6b5af5470f10c33c
MD5 eb07fb34cc8c96ef8a1ef207aa43b544
BLAKE2b-256 c2cfad7fd2c20710240b9b4b4d2e0b3c1452e9b1e55c2031baf641d190e4e287

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright-1.49.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.49.1-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for patchright-1.49.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 35e75b400eb4baee01e4a8300e0b309a11dca31239e8e4f92ad0f09a0cb7553a
MD5 0045e71f3f67818c80356e8c1fcdff62
BLAKE2b-256 69b9d89229b7442594f468ad019076c32971df82e76aa8c9b714b3150085e863

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright-1.49.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.49.1-py3-none-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for patchright-1.49.1-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 23e4ef8d291d2f30c2a993bc652defe3902b8132672bb169a780ed38d776b8f5
MD5 d02d5a88b57a80516c1193f6b46d1f92
BLAKE2b-256 2e321aa0cd16b47335705afe6aae89fb49c7432771df0b01252f28fad2682f75

See more details on using hashes here.

Provenance

The following attestation bundles were made for patchright-1.49.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 AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page