- Notifications
You must be signed in to change notification settings - Fork21
Undetected NodeJS version of the Playwright testing and automation library.
License
Kaliiiiiiiiii-Vinyzu/patchright-nodejs
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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 thePython Package.Also check out the mainPatchright Driver Repository
# Install Patchright from NPMnpm i patchright
# Install Chromium-Driver for Patchrightnpx patchright install chromium
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!const{ chromium}=require('patchright');(async()=>{constbrowser=awaitchromium.launch();constpage=awaitbrowser.newPage();awaitpage.goto('http://example.com');// other actions...awaitbrowser.close();})();
To be completely undetected, use the following configuration:
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 vianpx patchright install chrome
(or via any other installation method) and use it withchannel: "chrome"
.
Runtime.enable Leak
This is the biggest Patch Patchright uses. To avoid detection by this leak, patchright avoids usingRuntime.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.
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.
With the right setup, Patchright currently is considered undetectable.Patchright passes:
- Brotector ✅ (withCDP-Patches)
- Cloudflare ✅
- Kasada ✅
- Akamai ✅
- Shape/F5 ✅
- Bet365 ✅
- Datadome ✅
- Fingerprint.com ✅
- CreepJS ✅
- Sannysoft ✅
- Incolumitas ✅
- IPHey ✅
- Browserscan ✅
- Pixelscan ✅
See the originalPlaywright Documentation andAPI Reference
evaluate
Method(Frame.evaluate
,Page.evaluate
,Locator.evaluate
,Worker.evaluate
,JSHandle.evaluate
)
- Added
isolatedContext
to choose Execution Context (Main/Isolated).Bool
(optional, Defaults totrue
)
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 totrue
)
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 toTrue
)
Locator.evaluateAll( pageFunction: Function | string, arg?: Arg, ...,+ isolatedContext: boolean = true)
The bugs are documented in thePatchright Driver Repository.
The TODO is documented in thePatchright 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.
Patchright is licensedApache 2.0
This repository is provided foreducational purposes only.
No warranties are provided regarding accuracy, completeness, or suitability for any purpose.Use at your own risk—the authors and maintainers assumeno liability forany damages,legal issues, orwarranty 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
About
Undetected NodeJS version of the Playwright testing and automation library.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.