Patchright 1.57.0

dotnet add package Patchright --version 1.57.0
                    
NuGet\Install-Package Patchright -Version 1.57.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Patchright" Version="1.57.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Patchright" Version="1.57.0" />
                    
Directory.Packages.props
<PackageReference Include="Patchright" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Patchright --version 1.57.0
                    
#r "nuget: Patchright, 1.57.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Patchright@1.57.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Patchright&version=1.57.0
                    
Install as a Cake Addin
#tool nuget:?package=Patchright&version=1.57.0
                    
Install as a Cake Tool

🎭 Patchright .NET

Patchright is a patched and undetected version of the Playwright Testing and Automation Framework for .NET. </br> It can be used as a drop-in replacement for Playwright.

This repository serves the Patchright .NET Package. To use Patchright with Python or NodeJS, check out the Python Package or the NodeJS Package. Also check out the main Patchright Driver Repository


Installation

Patchright can be found on NuGet and can be installed by copying and pasting the following command into your Package Manager Console within Visual Studio (Tools > NuGet Package Manager > Package Manager Console).

Install-Package Patchright

Alternatively if you're using .NET Core then you can install Patchright via the command line interface with the following command:

dotnet add package Patchright

Usage

Instead of using the Microsoft.Playwright package just install the Patchright package instead. Patchright is a drop-in-replacement for Playwright!

Patchright only patches CHROMIUM based browsers. Firefox and Webkit are not supported.

using Microsoft.Playwright;
using System.Threading.Tasks;

class Program
{
    public static async Task Main()
    {
        using var playwright = await Playwright.CreateAsync();
        await using var browser = await playwright.Chromium.LaunchAsync();
        var page = await browser.NewPageAsync();
        await page.GotoAsync("https://playwright.dev");
        await page.ScreenshotAsync(new() { Path = "screenshot.png" });
    }
}

Best Practice - use Chrome without Fingerprint Injection

To be completely undetected, use the following configuration:

await using var context = await playwright.Chromium.LaunchPersistentContextAsync(
    userDataDir: "...",
    new BrowserTypeLaunchPersistentContextOptions 
    {
        Channel = "chrome",
        Headless = false,
        NoViewport = true,
        // do NOT add custom browser headers or userAgent
    });

We recommend using Google Chrome instead of Chromium. You can install it via ./playwright.ps1 install --with-deps chrome (or via any other installation method) and use it with Channel = "chrome".


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.

Closed Shadow Roots

Patchright is able to interact with elements in Closed Shadow Roots. Just use normal locators and Patchright will do the rest. <br/> Patchright is now also able to use XPaths in Closed Shadow Roots.


Stealth

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

Documentation and API Reference

See the original Playwright .NET Documentation and API Reference

Extended Patchright API

EvaluateAsync Method <sub>(IFrame.EvaluateAsync, IJSHandle.EvaluateAsync, ILocator.EvaluateAsync, IPage.EvaluateAsync, IWorker.EvaluateAsync)</sub>
  • Added isolatedContext to choose Execution Context (Main/Isolated). bool (optional, Defaults to true)
Task<T> EvaluateAsync<T>(
    string expression, 
    object? arg = default,
+   bool isolatedContext = true);
EvaluateHandleAsync Method <sub>(IFrame.EvaluateHandleAsync, IJSHandle.EvaluateHandleAsync, ILocator.EvaluateHandleAsync, IPage.EvaluateHandleAsync, IWorker.EvaluateHandleAsync)</sub>
  • Added isolatedContext to choose Execution Context (Main/Isolated). bool (optional, Defaults to true)
Task<IJSHandle> EvaluateHandleAsync(
    string expression, 
    object? arg = default,
+   bool isolatedContext = true);
EvaluateAllAsync Method <sub>(ILocator.EvaluateAllAsync)</sub>
  • Added isolatedContext to choose Execution Context (Main/Isolated). bool (optional, Defaults to true)
Task<IJSHandle> EvaluateAllAsync(
    string expression, 
    object? arg = default,
+   bool isolatedContext = true);
EvalOnSelectorAsync Method <sub>(IPage.EvalOnSelectorAsync, IFrame.EvalOnSelectorAsync)</sub>
  • Added isolatedContext to choose Execution Context (Main/Isolated). bool (optional, Defaults to true)
Task<T> EvalOnSelectorAsync<T>(
    string selector,
    string expression,
    object? arg = default,
    EvalOnSelectorOptions? options = default,
+   bool isolatedContext = true);
EvalOnSelectorAllAsync Method <sub>(IPage.EvalOnSelectorAllAsync, IFrame.EvalOnSelectorAllAsync)</sub>
  • Added isolatedContext to choose Execution Context (Main/Isolated). bool (optional, Defaults to true)
Task<T> EvalOnSelectorAllAsync<T>(
    string selector,
    string expression,
    object? arg = default,
+   bool isolatedContext = true);

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 not automatic (yet), and bugs due to Playwright codebase changes may occur. Fixes for these bugs might take a few days to be released manually.


Support our work

If you choose to support our work, please contact @vinyzu or @steve_abcdef on Discord.


Β© 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: Werner van Deventer
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.57.0 198 12/29/2025
1.56.0 732 12/3/2025