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-NodeJS Package. To use Patchright with Python, check out the Python Package. Also check out the main Patchright Driver Repository
# Install Patchright from NPM
npm i patchright
# Install Chromium-Driver for Patchright
npx patchright install chromium
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!
const { chromium } = require('patchright');
(async () => {
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('http://example.com');
// other actions...
await browser.close();
})();
To be completely undetected, use the following configuration:
chromium.launchPersistentContext("...", {
channel: "chrome",
headless: false,
viewport: null,
});
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.
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
Patchright patches some general leaks in the Playwright codebase. This mainly includes poor setups and obvious detection points.
With the right setup, Patchright currently is considered undetectable. Patchright passes:
- Brotector β (with CDP-Patches)
- Cloudflare β
- Kasada β
- Akamai β
- Shape/F5 β
- Bet365 β
- Datadome β
- Fingerprint.com β
- CreepJS β
- Sannysoft β
- Incolumitas β
- IPHey β
- Browserscan β
- Pixelscan β
See the original Playwright Documentation and API Reference
The bugs are documented in the Patchright Driver Repository.
The TODO is documented in the Patchright Driver Repository.
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.
If you choose to support our work, please contact @vinyzu or @steve_abcdef on Discord.
Β© Vinyzu
Patchright is licensed Apache 2.0
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.