Stealth for Playwright in .NET. Reduce common browser automation signals with a single call, using the Microsoft.Playwright APIs you already know.
- 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.
dotnet add package ManagedCode.Playwright.StealthInstall Playwright's Chromium browser for your application before the first launch.
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.
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.
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.
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.
Adapted for .NET from the original playwright_stealth project.
MIT.