Skip to content

About

Stealth evasion library for Microsoft.Playwright (.NET). Applies 31 init-script patches that mask headless Chrome fingerprints — navigator properties, WebGL, canvas, audio, CDP traces, automation markers and more. Validated against 9 public bot-detection sites.

Topics

Resources

Stars

9 stars

Watchers

1 watching

Forks

Repository files navigation

ManagedCode.Playwright.Stealth

NuGet Downloads License: MIT

Stealth for Playwright in .NET. Reduce common browser automation signals with a single call, using the Microsoft.Playwright APIs you already know.

Highlights

  • One-call setup — launch Chromium with stealth already applied.
  • Headless and headful — use the same API for background automation and visible browsers.
  • Consistent browser identity — keep pages and Chromium workers aligned.
  • Configurable behavior — customize navigator values and enable or disable individual patches.
  • Native defaults — preserve native GPU, media and browser values where available; canvas and audio noise are opt-in.

Built for .NET 10 and Microsoft.Playwright.

Install

dotnet add package ManagedCode.Playwright.Stealth

Install Playwright's Chromium browser for your application before the first launch.

Quick Start

using Microsoft.Playwright;
using ManagedCode.Playwright.Stealth;

using var playwright = await Playwright.CreateAsync();
var (browser, context) = await playwright.Chromium.LaunchStealthAsync();

var page = await context.NewPageAsync();
await page.GotoAsync("https://www.browserscan.net/bot-detection");

await context.CloseAsync();
await browser.CloseAsync();

Stealth is applied to the context before pages are created, so every page inherits the configuration.

Use Your Own Browser Context

Keep your existing launch options and add stealth to your context:

using var playwright = await Playwright.CreateAsync();
await using var browser = await playwright.Chromium.LaunchAsync(new()
{
    Headless = true,
    Channel = "chromium",
    Args = PlaywrightStealthExtensions.StealthArgs
});

await using var context = await browser.NewContextAsync();
await context.ApplyStealthAsync();

var page = await context.NewPageAsync();
await page.GotoAsync("https://www.browserscan.net/bot-detection");

Apply stealth before creating pages. Set Headless = false to use a visible browser.

Customize

Pass a StealthConfig to choose the browser profile and patches your application needs:

var config = new StealthConfig
{
    NavigatorHardwareConcurrency = 8,
    NavigatorDeviceMemory = 16,
    Languages = ["en-US", "en"],
    CanvasFingerprint = false,
    AudioContext = false
};

await context.ApplyStealthAsync(config);

You can also pass the configuration directly to LaunchStealthAsync. See StealthConfig for all available options.

Bot Detection Coverage

Browser checks cover Iphey, DeviceAndBrowserInfo, CreepJS and its prototype checks, and Incolumitas in both headless and headful Chromium.

Coverage also includes BrowserScan, SannySoft, Intoli, Fingerprint, Are You Headless and PixelScan.

Attribution

Adapted for .NET from the original playwright_stealth project.

License

MIT.

About

Stealth evasion library for Microsoft.Playwright (.NET). Applies 31 init-script patches that mask headless Chrome fingerprints — navigator properties, WebGL, canvas, audio, CDP traces, automation markers and more. Validated against 9 public bot-detection sites.

Topics

Resources

Stars

9 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages