Browser

Stealth and Anti-Detection

WithUseStealth(StealthType) configures which anti-detection measures GPAL applies to the browser session. StealthType is a Flags enum, so multiple options can be combined with the bitwise OR operator.

StealthType.CDP injects a script that hides Chrome DevTools Protocol detection signals before any page script runs. StealthType.GoogleReferrer sets the HTTP referrer to look like the browser arrived from a Google search results page. StealthType.DarkMode launches Chrome with the force-dark-mode flag. StealthType.PatchDriver patches the chromedriver binary itself to remove known automation markers before the browser launches.

Use StealthType.All to enable every measure, or StealthType.None (the default) to disable stealth entirely.

StealthLeftClick clicks through the input layer rather than the DOM, so the page sees a trusted event.

NOTE

CDP protection, toString override, and Google referrer spoofing are applied once per browser session, the first time GoTo or Get runs. DarkMode and PatchDriver take effect at browser launch, so call WithUseStealth before the first GoTo or Get.

WARNING

StealthType.CDP has no effect when using the OttoMagic automation engine - it applies only to the Selenium and JavaScript-injection based engines.

Examples

GPAL Fluent: High-level fluent C# API

//WithUseStealth accepts a bitwise combination of StealthType flags and should be set before the first GoTo or Get call.

// Enable a combination of stealth measures before navigating

GPAL.Browser

.WithBrowserType(BrowserType.Chrome)

.WithUseStealth(StealthType.CDP | StealthType.GoogleReferrer)

.GoTo("https://example.com");


// Enable every stealth measure

GPAL.Browser

.WithBrowserType(BrowserType.Chrome)

.WithUseStealth(StealthType.All)

.GoTo("https://example.com");


// Patch chromedriver and force dark mode at launch

GPAL.Browser

.WithBrowserType(BrowserType.Chrome)

.WithUseStealth(StealthType.PatchDriver | StealthType.DarkMode)

.GoTo("https://example.com");


💬 Ask GPAL