A high-level API to automate web browsers
npm install patchright#### 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
---
Sponsors
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
---
``bash`Install Patchright from NPM
npm i patchright
`bash`Install Chromium-Driver for Patchright
npx patchright install chromium
---
> [!IMPORTANT]
> Patchright only patches CHROMIUM based browsers. Firefox and Webkit are not supported.
`js
// 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:
`js`
chromium.launchPersistentContext("...", {
channel: "chrome",
headless: false,
viewport: null,
// do NOT add custom browser headers or userAgent
});
> [!NOTE]
> We recommend using Google Chrome instead of Chromium.
> You can install it via npx patchright install chrome (or via any other installation method) and use it with channel: "chrome".
---
(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$3
Patchright patches some general leaks in the Playwright codebase. This mainly includes poor setups and obvious detection points.$3
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:
- Brotector β
(with CDP-Patches)
- Cloudflare β
- Kasada β
- Akamai β
- Shape/F5 β
- Bet365 β
- Datadome β
- Fingerprint.com β
- CreepJS β
- Sannysoft β
- Incolumitas β
- IPHey β
- Browserscan β
- Pixelscan β
---
Documentation and API Reference
See the original Playwright Documentation and API ReferenceExtended Patchright API
#### evaluate Method (Frame.evaluate, Page.evaluate, Locator.evaluate, Worker.evaluate, JSHandle.evaluate)
- Added isolatedContext to choose Execution Context (Main/Isolated). Bool (optional, Defaults to true)
`diff
object.evaluate(
pageFunction: Function | string,
arg?: Arg,
...,
+ isolatedContext: boolean = true
)
`####
evaluateHandle Method (Frame.evaluateHandle, Page.evaluateHandle, Locator.evaluateHandle, Worker.evaluateHandle, JSHandle.evaluateHandle)
- Added isolatedContext to choose Execution Context (Main/Isolated). Bool (optional, Defaults to true)
`diff
object.evaluateHandle(
pageFunction: Function | string,
arg?: Arg,
...,
+ isolatedContext: boolean = true
)
`####
evaluateAll Method (Locator.evaluateAll)
- Added isolated_context to choose Execution Context (Main/Isolated). Bool (optional, Defaults to True)
`diff
Locator.evaluateAll(
pageFunction: Function | string,
arg?: Arg,
...,
+ isolatedContext: boolean = true
)
``---
---
---
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.
---
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.
---
#### Active Maintainer: Vinyzu Co-Maintainer: Kaliiiiiiiiii