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


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.48.0.post0-py3-none-win_amd64.whl (30.0 MB view details)

Uploaded Python 3 Windows x86-64

patchright-1.48.0.post0-py3-none-win32.whl (30.0 MB view details)

Uploaded Python 3 Windows x86

patchright-1.48.0.post0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (37.9 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ARM64

patchright-1.48.0.post0-py3-none-macosx_11_0_universal2.whl (35.0 MB view details)

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

patchright-1.48.0.post0-py3-none-macosx_11_0_arm64.whl (33.3 MB view details)

Uploaded Python 3 macOS 11.0+ ARM64

patchright-1.48.0.post0-py3-none-macosx_10_13_x86_64.whl (35.0 MB view details)

Uploaded Python 3 macOS 10.13+ x86-64

File details

Details for the file patchright-1.48.0.post0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for patchright-1.48.0.post0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 3420f3521f44d4f51c80e3e23f03d59a399d82d71901aed38d7e2bc5b554b316
MD5 8f31415d885e60f00435f0ba682e477c
BLAKE2b-256 e3c981ee1f9ba2ff7cfa4585e4e100eb264ea2c45b52a737c6765b4d36952e24

See more details on using hashes here.

Provenance

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

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

Attestations:

File details

Details for the file patchright-1.48.0.post0-py3-none-win32.whl.

File metadata

File hashes

Hashes for patchright-1.48.0.post0-py3-none-win32.whl
Algorithm Hash digest
SHA256 5749818f2a85860b43b3668295fd566b1d76d4b5641493db68d60ce776dc1b72
MD5 b94a30bfc5e8fa6698199f9607ff1730
BLAKE2b-256 2fd081900be50b63c2e62b89e662d97ceee48b13dcdb59146f043cfc531d3106

See more details on using hashes here.

Provenance

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

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

Attestations:

File details

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

File metadata

File hashes

Hashes for patchright-1.48.0.post0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4512b18f9751cf9fc31fa4e1a2b66e7aa1a6524903069a176ed0db127a329e24
MD5 89e5d1945fa9cac409ad590257ccb48d
BLAKE2b-256 7d43118058b582a0faf2d71af7b3ac38915d1bb14e858b108f22815f3590bf71

See more details on using hashes here.

Provenance

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

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

Attestations:

File details

Details for the file patchright-1.48.0.post0-py3-none-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for patchright-1.48.0.post0-py3-none-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 79c4a8003288b1a420a9c97358e07c237777959e8a6715bc78da885719f0d119
MD5 24749c89ec79a12f0f6f095db5e238c7
BLAKE2b-256 e3b64fd4e01afcde95c0137f3f7db8fd07ec3fc42a810a1ef4acaa928ec6021a

See more details on using hashes here.

Provenance

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

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

Attestations:

File details

Details for the file patchright-1.48.0.post0-py3-none-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for patchright-1.48.0.post0-py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 06fd8ae6bb19abbf362eebdb965bfe7bb39aca0dfe3825207bc09a536e0b6960
MD5 89dc6dce5c6c56d70fb12baeb2d39271
BLAKE2b-256 5e4d386564ad33a751be238d0351d2464568f2ddc709e28747be5e8d36f776dd

See more details on using hashes here.

Provenance

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

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

Attestations:

File details

Details for the file patchright-1.48.0.post0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for patchright-1.48.0.post0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 51c32ffab0257f70c678dba6a9a0caf2659cea1aabf3a895a20401459d60b42d
MD5 3eac4d0d7aadd1c178ebfec70877052e
BLAKE2b-256 8380e104cc6aadc94ce1efb55902f16204a049eb9c650ecbc39c073f4e47f05b

See more details on using hashes here.

Provenance

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

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

Attestations:

File details

Details for the file patchright-1.48.0.post0-py3-none-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for patchright-1.48.0.post0-py3-none-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 2417a6ffe588a00c8d967246fcaa91f585ba7a5d07f344d8c1a0c4c5d2ebc527
MD5 cfbf67398f64d4d653f8e658cbe37bbf
BLAKE2b-256 5ff061fe5a4b7e04a7044e15c75a89e9f1a580c04ffd288cc609847876b1e269

See more details on using hashes here.

Provenance

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

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

Attestations:

Supported by

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