### StealthVendorSettings Examples Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/configuration.md Configure navigator.vendor and navigator.vendorSub properties with StealthVendorSettings. Examples show setting for Chrome on Windows/Mac and an empty configuration for evasion. ```csharp new StealthVendorSettings("Google Inc.", "") ``` ```csharp new StealthVendorSettings() // Both empty ``` -------------------------------- ### Custom Rule Implementation Example Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/BlockResourcesPlugin.md Example of implementing the IBlockRule interface for advanced custom blocking logic. ```csharp public class SmartAdBlocker : IBlockRule { public bool ShouldBlock(IRequest request) { var isAdDomain = request.Url.Contains("ad-") || request.Url.Contains("ads."); var isTracking = request.Url.Contains("track") || request.Url.Contains("analytics"); return (isAdDomain || isTracking) && (request.ResourceType == ResourceType.Script || request.ResourceType == ResourceType.XHR); } } blockPlugin.AddRule(new SmartAdBlocker()); ``` -------------------------------- ### Url Pattern Examples Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/BlockResourcesPlugin.md Demonstrates different glob patterns for blocking URLs. ```csharp builder.Url("*google-analytics*") ``` ```csharp builder.Url("https://ads.*") ``` ```csharp builder.Url("*.tracking-domain.com") ``` -------------------------------- ### GetDependencies Implementation Example Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtraPlugin.md An example of how to implement the GetDependencies method to specify plugin dependencies. ```csharp protected internal override ICollection GetDependencies() { return new List { new WebDriver(), new ChromeRuntime() }; } ``` -------------------------------- ### CustomPlugin Implementation Example Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtraPlugin.md An example demonstrating the implementation of a custom PuppeteerExtraPlugin, including setting requirements and overriding lifecycle methods like OnPageCreatedAsync and BeforeLaunchAsync. ```csharp public class CustomPlugin : PuppeteerExtraPlugin { public CustomPlugin() : base("custom-plugin") { } public override List Requirements => new() { PluginRequirements.Launch }; protected internal override async Task OnPageCreatedAsync(IPage page) { await page.EvaluateExpressionOnNewDocumentAsync( "window.customNamespace = { custom: true };"); } protected internal override Task BeforeLaunchAsync(LaunchOptions options) { options.Args = options.Args.Append("--custom-flag").ToArray(); return Task.CompletedTask; } } ``` -------------------------------- ### Block All Images and Stylesheets Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/BlockResourcesPlugin.md Example of initializing the plugin and adding a rule to block all images and stylesheets. ```csharp var extra = new PuppeteerExtra(); var blockPlugin = new BlockResourcesPlugin(); blockPlugin.AddRule(builder => builder .Resources(ResourceType.Image, ResourceType.Stylesheet) ); extra.Use(blockPlugin); var browser = await extra.LaunchAsync(); var page = await browser.NewPageAsync(); // Images and stylesheets will be blocked on all pages ``` -------------------------------- ### StealthHardwareConcurrencyOptions Examples Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/configuration.md Set the reported CPU core count using StealthHardwareConcurrencyOptions. Examples show setting to 4 and 8 cores. ```csharp new StealthHardwareConcurrencyOptions(4) ``` ```csharp new StealthHardwareConcurrencyOptions(8) ``` -------------------------------- ### Quick Start with PuppeteerExtraSharp Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/README.md This snippet demonstrates how to initialize PuppeteerExtraSharp, enable the Stealth plugin, launch the browser, navigate to a page, and take a screenshot. ```csharp // Initialize plugin builder var extra = new PuppeteerExtra(); // Enable the Stealth plugin extra.Use(new StealthPlugin()); // Launch the browser with plugins applied var browser = await extra.LaunchAsync(); // Create a new page var page = await browser.NewPageAsync(); await page.GoToAsync("https://google.com"); await Task.Delay(2000); // Take a screenshot await page.ScreenshotAsync("extra.png"); ``` -------------------------------- ### Quick Start: Initialize and Use Block Resources Plugin Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/PuppeteerExtraSharp/Plugins/BlockResources/README.md Demonstrates how to initialize the BlockResourcesPlugin, register it with PuppeteerExtra, and launch a browser. It also shows how to add various rules before navigating to a page to block specific resource types or requests based on URL patterns and custom predicates. ```csharp var blockResourcesPlugin = new BlockResourcesPlugin(); var puppeteerExtra = new PuppeteerExtra(); var browser = await puppeteerExtra.Use(blockResourcesPlugin).LaunchAsync(); var page = await browser.NewPageAsync(); // Add some rules BEFORE navigation for best effect // 1) Block scripts for a specific page and URL pattern blockResourcesPlugin.AddRule(s => s.Page(page) .Url("ads.js") .Resources(ResourceType.Script)); // 2) Block non-navigation requests via a custom predicate blockResourcesPlugin.AddRule(s => s.Custom(request => !request.IsNavigationRequest)); // 3) Block all scripts on all pages blockResourcesPlugin.AddRule(s => s.Resources(ResourceType.Script)); // 4) Block all images on a specific page blockResourcesPlugin.AddRule(s => s.Page(page) .Resources(ResourceType.Image)); await page.GoToAsync("https://adblock.turtlecute.org/"); // many/most requests will be blocked ``` -------------------------------- ### Custom Blocking Logic Example Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/BlockResourcesPlugin.md Example of adding a rule with custom blocking logic based on resource type and URL. ```csharp blockPlugin.AddRule(builder => builder .Custom(req => req.ResourceType == ResourceType.XHR && req.Url.Contains("api/internal") ) ); ``` -------------------------------- ### BrowserStartContext Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/types.md Context information about browser startup, including whether it's headless and its start type. ```APIDOC ## BrowserStartContext ### Description Context information about browser startup. ### Properties - **IsHeadless** (bool) - Whether the browser launched in headless mode - **StartType** (StartType) - Whether browser was launched or connected ``` -------------------------------- ### Integration Example with Puppeteer Sharp Extra Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/INDEX.md Demonstrates how to launch a browser with multiple plugins enabled, navigate to a page, and solve captchas using the CaptchaSolverPlugin. Ensure you have the necessary API key for the captcha provider. ```csharp using PuppeteerExtraSharp; using PuppeteerExtraSharp.Plugins.BlockResources; using PuppeteerExtraSharp.Plugins.ExtraStealth; using PuppeteerExtraSharp.Plugins.CaptchaSolver.Providers.CapSolver; using PuppeteerExtraSharp.Plugins.CaptchaSolver; using PuppeteerExtraSharp.Plugins.AnonymizeUa; using PuppeteerSharp; class Program { static async Task Main() { var extra = new PuppeteerExtra(); extra.Use(new StealthPlugin()); extra.Use(new BlockResourcesPlugin()); extra.Use(new AnonymizeUaPlugin()); extra.Use(new CaptchaSolverPlugin( new CapSolver("api-key"), new CaptchaOptions { CaptchaWaitTimeout = TimeSpan.FromSeconds(15) } )); var browser = await extra.LaunchAsync(new LaunchOptions { Headless = true, Args = new[] { "--no-sandbox" } }); try { var page = await browser.NewPageAsync(); await page.GoToAsync("https://example.com"); var captchaPlugin = extra.GetPlugin(); var result = await captchaPlugin.SolveCaptchaAsync(page); if (!string.IsNullOrEmpty(result.Error)) Console.WriteLine($"Error: {result.Error}"); else Console.WriteLine($"Solved {result.Solved.Count} captchas"); } finally { await browser.CloseAsync(); } } } ``` -------------------------------- ### Configure CaptchaSolverPlugin with Provider and Options Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/configuration.md Example of creating a CaptchaSolverPlugin instance with a specific provider and custom options. ```csharp var provider = new CapSolver("api-key"); var options = new CaptchaOptions { ThrowOnError = false }; var plugin = new CaptchaSolverPlugin(provider, options); ``` -------------------------------- ### Basic Captcha Solving Example Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/CaptchaSolverPlugin.md Demonstrates the basic usage of CaptchaSolverPlugin to launch a browser, navigate to a page with a CAPTCHA, and solve it. ```csharp var extra = new PuppeteerExtra(); var provider = new CapSolver("api-key"); var options = new CaptchaOptions(); extra.Use(new CaptchaSolverPlugin(provider, options)); var browser = await extra.LaunchAsync(); var page = await browser.NewPageAsync(); await page.GoToAsync("https://example-with-captcha.com"); var result = await extra.GetPlugin() .SolveCaptchaAsync(page); if (result.Solved.Any()) { Console.WriteLine("CAPTCHA solved!"); if (result.NeedsReload) await page.ReloadAsync(); } ``` -------------------------------- ### StealthPlugin with Options Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/configuration.md Instantiate StealthPlugin with specific evasion options. This example configures language and WebGL spoofing. ```csharp var stealth = new StealthPlugin( new StealthLanguagesOptions("en-US", "en"), new StealthWebGLOptions("Intel Inc.", "Intel Iris OpenGL Engine") ); ``` -------------------------------- ### Configure ResourcesBlockBuilder Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/configuration.md Example of using ResourcesBlockBuilder to define rules for blocking resources based on type, URL pattern, and custom predicates. ```csharp builder .Resources(ResourceType.Image, ResourceType.Script) .Url("*analytics*") .Custom(req => req.Method == HttpMethod.Post) ``` -------------------------------- ### Instantiate StealthVendorSettings Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/StealthPlugin.md Example of creating a new StealthVendorSettings object with specific vendor and vendorSub values. This is used to spoof the navigator.vendor property. ```csharp new StealthVendorSettings("Google Inc.", "") ``` -------------------------------- ### BeforeLaunchAsync Lifecycle Method Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtraPlugin.md This method is called before the browser is launched. It allows modification of launch options, such as adding arguments. The example shows how to append a '--disable-features' argument. ```csharp protected internal override Task BeforeLaunchAsync(LaunchOptions options) { options.Args = options.Args.Append("--disable-features=IsolateOrigins").ToArray(); return Task.CompletedTask; } ``` -------------------------------- ### Block Resources Per-Page Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/BlockResourcesPlugin.md Example of applying a blocking rule to a specific page instance. ```csharp var page1 = await browser.NewPageAsync(); var page2 = await browser.NewPageAsync(); blockPlugin.AddRule(builder => builder .Resources(ResourceType.Image) .Page(page1) // Only on page1 ); ``` -------------------------------- ### Initialize PuppeteerExtra Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtra.md Initializes a new instance of PuppeteerExtra with an empty plugin list. This is the starting point for adding plugins and launching browsers. ```csharp var extra = new PuppeteerExtra(); ``` -------------------------------- ### Configure BlockResourcesPlugin with Error Code and Priority Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/configuration.md Example of creating a BlockResourcesPlugin instance with specific error code and priority. ```csharp var blockPlugin = new BlockResourcesPlugin( RequestAbortErrorCode.AccessDenied, priority: 100 ); ``` -------------------------------- ### Configure CaptchaOptions Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/configuration.md Example of setting various properties for CaptchaOptions, including enabled vendors, timeouts, error handling, and proxy settings. ```csharp var options = new CaptchaOptions { EnabledVendors = new() { CaptchaVendor.Google, CaptchaVendor.Cloudflare }, CaptchaWaitTimeout = TimeSpan.FromSeconds(10), ThrowOnError = false, MinScore = 0.7, SolveInViewportOnly = true, ProxyType = "https", ProxyAddress = "proxy.example.com", ProxyPort = 8080, ProxyLogin = "user", ProxyPassword = "pass" }; ``` -------------------------------- ### Block Tracking Domains Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/BlockResourcesPlugin.md Example of adding a rule to block multiple tracking domains and how to remove it later. ```csharp var trackingRule = blockPlugin.AddRule(builder => builder .Url("*google-analytics*") .Url("*tracking-domain*") ); // Later remove the rule blockPlugin.RemoveRule(trackingRule); ``` -------------------------------- ### Quick Start: Solve reCAPTCHA with PuppeteerExtraSharp Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/PuppeteerExtraSharp/Plugins/Recaptcha/readme.md Initialize the 2Captcha provider and the reCAPTCHA plugin, then launch the browser. Use the plugin to solve a reCAPTCHA on a page and then submit the form. ```csharp var twoCaptchaProvider = new TwoCaptcha(""); var recaptchaPlugin = new RecaptchaPlugin(twoCaptchaProvider); var puppeteerExtra = new PuppeteerExtra(); // Launch browser with the reCAPTCHA plugin enabled var browser = await puppeteerExtra.Use(recaptchaPlugin).LaunchAsync(); var page = await browser.NewPageAsync(); await page.GoToAsync("https://www.google.com/recaptcha/api2/demo"); // Single call to detect the widget, request a solution via the API, and inject the token await recaptchaPlugin.SolveCaptchaAsync(page); // Submit the form on the page var submitButton = await page.QuerySelectorAsync("#recaptcha-demo-submit"); await submitButton.ClickAsync(); ``` -------------------------------- ### Configure ResourcesBlockBuilder for Image and Font Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/BlockResourcesPlugin.md Example of using the Resources method on the ResourcesBlockBuilder to specify Image and Font as resource types to block. ```csharp builder.Resources(ResourceType.Image, ResourceType.Font) ``` -------------------------------- ### Initialize Puppeteer Extra with StealthPlugin and Custom Options Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/StealthPlugin.md Demonstrates how to initialize Puppeteer Extra with the StealthPlugin, applying custom options for languages, WebGL, and hardware concurrency. This setup is useful for advanced browser fingerprinting evasion. ```csharp var extra = new PuppeteerExtra(); // Initialize with custom options var stealth = new StealthPlugin( new StealthLanguagesOptions("de-DE", "de"), new StealthWebGLOptions("NVIDIA Corporation", "ANGLE (NVIDIA)"), new StealthHardwareConcurrencyOptions(8) ); extra.Use(stealth); ``` -------------------------------- ### Catch ArgumentException for Duplicate Options Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/errors.md Illustrates catching an ArgumentException when attempting to add duplicate plugin options. This example shows how to handle the error when the same option type is added more than once. ```csharp var stealth = new StealthPlugin(); stealth.AddOptions(new StealthLanguagesOptions("en-US")); stealth.AddOptions(new StealthLanguagesOptions("de-DE")); // Throws ``` -------------------------------- ### BrowserStartContext Class Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/types.md Defines the context information for browser startup, indicating whether it's headless and its start type. Used internally by PuppeteerExtra to validate plugin requirements. ```csharp public class BrowserStartContext { public bool IsHeadless { get; set; } public StartType StartType { get; set; } } ``` -------------------------------- ### Configure ResourcesBlockBuilder for a Specific Page Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/BlockResourcesPlugin.md Example of using the Page method on the ResourcesBlockBuilder to filter requests originating from a specific IPage instance. ```csharp var page1 = await browser.NewPageAsync(); builder.Page(page1) // Block only on page1 ``` -------------------------------- ### OnPageCreatedAsync Lifecycle Method Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtraPlugin.md This method is invoked whenever a new page is created. It's useful for per-page initialization tasks like setting the user agent or viewport. The example demonstrates setting a custom user agent and viewport. ```csharp protected internal override async Task OnPageCreatedAsync(IPage page) { await page.SetUserAgentAsync("custom-agent"); await page.SetViewportAsync(new ViewPortOptions { Width = 1920, Height = 1080 }); } ``` -------------------------------- ### LaunchAsync (no parameters) Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtra.md Launches a new browser instance with default launch options and applies all registered plugins. ```APIDOC ## LaunchAsync (no parameters) ### Description Launches a browser with default launch options. ### Method `Task LaunchAsync()` ### Return Type `Task` — Task resolving to an IBrowser instance. ### Example ```csharp var extra = new PuppeteerExtra(); extra.Use(new StealthPlugin()); var browser = await extra.LaunchAsync(); ``` ``` -------------------------------- ### LaunchAsync (with options) Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtra.md Launches a new browser instance with specified launch options and applies all registered plugins, including executing plugin lifecycle methods before and after launch. ```APIDOC ## LaunchAsync (with options) ### Description Launches a browser with specified options and applies all registered plugins. ### Method `async Task LaunchAsync(LaunchOptions options)` ### Parameters #### Path Parameters - **options** (LaunchOptions) - Required - PuppeteerSharp launch configuration ### Return Type `Task` — Task resolving to an IBrowser instance. ### Behavior 1. Calls `BeforeLaunchAsync()` on all plugins 2. Launches browser via Puppeteer.LaunchAsync 3. Calls `AfterLaunchAsync()` on all plugins 4. Registers event handlers and calls `OnPageCreatedAsync()` for existing pages 5. Orders plugins based on `PluginRequirements.RunLast` 6. Validates plugin requirements against browser configuration ### Example ```csharp var options = new LaunchOptions { Headless = true, Args = new[] { "--no-sandbox" } }; var browser = await extra.LaunchAsync(options); ``` ``` -------------------------------- ### LaunchOptions Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/configuration.md Configure options for launching a new browser instance. ```APIDOC ## LaunchOptions Class ### Description Defines common options for launching a browser instance with puppeteer-extra. ### Properties - **Args** (string[]) - Browser launch arguments. - **Headless** (bool) - Headless mode. - **ExecutablePath** (string) - Path to the Chrome/Chromium executable. - **UserDataDir** (string) - User profile directory. - **Port** (int) - Debug protocol port. - **Viewport** (Viewport) - Window size. - **IgnoreHTTPSErrors** (bool) - Ignore HTTPS errors. ``` -------------------------------- ### Launch Browser with Default Options Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtra.md Launches a browser instance using default launch options. Plugins are applied before launching. This is useful for quick browser startup. ```csharp var extra = new PuppeteerExtra(); extra.Use(new StealthPlugin()); var browser = await extra.LaunchAsync(); ``` -------------------------------- ### PuppeteerExtraPlugin.Name Property Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtraPlugin.md Gets the plugin's unique identifier. ```APIDOC ## PuppeteerExtraPlugin.Name Property ### Description Gets the plugin's unique identifier. ### Method `public string Name { get; }` ### Type `string` (read-only) ### Example ```csharp var plugin = new StealthPlugin(); Console.WriteLine(plugin.Name); // "stealth" ``` ``` -------------------------------- ### PuppeteerExtraPlugin.Requirements Property Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtraPlugin.md Gets the list of requirements this plugin has for the browser environment. ```APIDOC ## PuppeteerExtraPlugin.Requirements Property ### Description Gets the list of requirements this plugin has for the browser environment. ### Method `public virtual List Requirements { get; }` ### Type `List` (read-only, default: empty list) ### Values - `PluginRequirements.Launch` — Plugin requires browser to be launched (not connected) - `PluginRequirements.HeadFul` — Plugin requires headful (non-headless) mode - `PluginRequirements.RunLast` — Plugin should execute after all other plugins ### Example ```csharp public override List Requirements => new() { PluginRequirements.HeadFul, PluginRequirements.Launch }; ``` ``` -------------------------------- ### StartType Enum Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/types.md Enumerates the methods by which a browser can be initialized. Use 'Connect' for existing instances and 'Launch' for new processes. ```csharp public enum StartType { Connect, // Connected to existing browser instance Launch // Launched new browser process } ``` -------------------------------- ### Launch Browser with Custom Options Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtra.md Launches a browser instance with custom launch options. This method applies all registered plugins, including executing their 'BeforeLaunchAsync' and 'AfterLaunchAsync' hooks, and ensures plugin requirements are met. ```csharp var options = new LaunchOptions { Headless = true, Args = new[] { "--no-sandbox" } }; var browser = await extra.LaunchAsync(options); ``` -------------------------------- ### ConnectOptions Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/configuration.md Configure options for connecting to an existing browser instance. ```APIDOC ## ConnectOptions Class ### Description Defines options for connecting to an existing browser instance via WebSocket. ### Properties - **BrowserWSEndpoint** (string) - WebSocket endpoint of the browser. - **IgnoreHTTPSErrors** (bool) - Ignore HTTPS errors. ``` -------------------------------- ### Launch Browser with Plugins Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/INDEX.md Launches a headless browser instance with Stealth, BlockResources, and AnonymizeUa plugins enabled. Requires PuppeteerExtraSharp and its dependencies. ```csharp var extra = new PuppeteerExtra(); extra.Use(new StealthPlugin()); extra.Use(new BlockResourcesPlugin()); extra.Use(new AnonymizeUaPlugin()); var browser = await extra.LaunchAsync(new LaunchOptions { Headless = true }); var page = await browser.NewPageAsync(); await page.GoToAsync("https://example.com"); ``` -------------------------------- ### Handle Provider Credentials and Errors Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/errors.md Shows how to initialize a provider with an empty key, noting that errors occur during solving, not construction. Errors are caught via EnterCaptchaSolutionsResult.Error or CaptchaException. ```csharp var provider = new CapSolver(""); // Empty key // Error will occur during solving, not construction // Caught via EnterCaptchaSolutionsResult.Error or CaptchaException ``` -------------------------------- ### Initialize StealthPlugin with Options Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/StealthPlugin.md Instantiate StealthPlugin with specific language and WebGL options, then use it with PuppeteerExtra. ```csharp var stealth = new StealthPlugin( new StealthLanguagesOptions("en-US", "en"), new StealthWebGLOptions("Intel Inc.", "Intel Iris OpenGL Engine") ); var extra = new PuppeteerExtra(); extra.Use(stealth); ``` -------------------------------- ### PuppeteerExtraPlugin.OnPageCreatedAsync Method Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtraPlugin.md Called when a new page is created. Useful for per-page initialization, script injection, or request interception setup. ```APIDOC ## PuppeteerExtraPlugin.OnPageCreatedAsync Method ### Description Called when a new page is created (either by explicit NewPageAsync call or from an existing page). Useful for per-page initialization, script injection, or request interception setup. ### Method `protected internal virtual Task OnPageCreatedAsync(IPage page)` ### Parameters #### Path Parameters - **page** (IPage) - Required - The newly created page ### Return Type `Task` — Completed task by default. ### Use Case Per-page initialization, script injection, request interception setup. ### Example ```csharp protected internal override async Task OnPageCreatedAsync(IPage page) { await page.SetUserAgentAsync("custom-agent"); await page.SetViewportAsync(new ViewPortOptions { Width = 1920, Height = 1080 }); } ``` ``` -------------------------------- ### StartType Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/types.md Enumeration of browser initialization methods, indicating whether the browser was launched or connected to. ```APIDOC ## StartType ### Description Enumeration of browser initialization methods. ### Values - **Connect** - Connected to existing browser instance - **Launch** - Launched new browser process ``` -------------------------------- ### Configure StealthHardwareConcurrencyOptions Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/StealthPlugin.md Create StealthHardwareConcurrencyOptions to set the navigator.hardwareConcurrency value, reporting a specific number of CPU cores. ```csharp new StealthHardwareConcurrencyOptions(4) ``` -------------------------------- ### PuppeteerExtraPlugin Name Property Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtraPlugin.md This read-only string property returns the unique identifier of the plugin. Example shows how to instantiate a plugin and access its name. ```csharp var plugin = new StealthPlugin(); Console.WriteLine(plugin.Name); // "stealth" ``` -------------------------------- ### Configure LaunchOptions for Puppeteer Extra Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/configuration.md Set browser launch arguments, headless mode, executable path, user data directory, port, viewport size, and HTTPS error handling. ```csharp public class LaunchOptions { public string[] Args { get; set; } // Browser launch arguments public bool Headless { get; set; } // Headless mode public string ExecutablePath { get; set; } // Chrome/Chromium path public string UserDataDir { get; set; } // User profile directory public int Port { get; set; } // Debug protocol port public Viewport Viewport { get; set; } // Window size public bool IgnoreHTTPSErrors { get; set; } // Ignore HTTPS errors } ``` ```csharp var options = new LaunchOptions { Headless = true, Args = new[] { "--no-sandbox", "--disable-setuid-sandbox" }, Viewport = new Viewport { Width = 1920, Height = 1080 } }; var browser = await extra.LaunchAsync(options); ``` -------------------------------- ### Initialize CaptchaSolver Plugin with Custom Options Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/PuppeteerExtraSharp/Plugins/CaptchaSolver/readme.md Demonstrates creating a CaptchaSolverPlugin with a specific provider and then overriding options for a single CAPTCHA solve operation. ```csharp var captchaSolver = new CaptchaSolverPlugin( new CapSolver("YOUR_API_KEY") ); extra.Use(captchaSolver); var browser = await extra.LaunchAsync(new LaunchOptions { Headless = false }); var page = await browser.NewPageAsync(); await page.GoToAsync("https://example.com/captcha"); // Override options for this specific solve var customOptions = new CaptchaSolverOptions { SolveInViewportOnly = true, ThrowOnError = true }; var result = await captchaSolver.SolveCaptchaAsync(page, customOptions); ``` -------------------------------- ### PuppeteerExtraPlugin Requirements Property Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtraPlugin.md This read-only property returns a list of requirements for the plugin, such as needing the browser to be launched or in headful mode. The example demonstrates how to override this property to specify requirements. ```csharp public override List Requirements => new() { PluginRequirements.HeadFul, PluginRequirements.Launch }; ``` -------------------------------- ### Initialize Stealth Plugin with Hardware Concurrency Options Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/PuppeteerExtraSharp/Plugins/ExtraStealth/readme.md Initialize the Stealth plugin with custom hardware concurrency options. This allows you to set a specific value for the hardware concurrency to evade detection. ```csharp var extra = new PuppeteerExtra(); // Initialize hardware concurrency plugin options var stealthHardwareConcurrencyOptions = new StealthHardwareConcurrencyOptions(12); // Put it on stealth plugin constructor var stealth = new StealthPlugin(stealthHardwareConcurrencyOptions); var browser = await extra.Use(stealth).LaunchAsync(new LaunchOptions()); var page = await browser.NewPageAsync(); await page.GoToAsync("https://bot.sannysoft.com/"); ``` -------------------------------- ### Basic CaptchaSolver Plugin Usage with CapSolver Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/PuppeteerExtraSharp/Plugins/CaptchaSolver/readme.md Demonstrates how to initialize the CaptchaSolver plugin with the CapSolver provider and integrate it with PuppeteerExtraSharp. Includes launching the browser, navigating to a page, and solving CAPTCHAs. ```csharp var captchaSolver = new CaptchaSolverPlugin( new CapSolver("YOUR_CAPSOLVER_API_KEY") ); var extra = new PuppeteerExtra(); extra.Use(captchaSolver); var browser = await extra.LaunchAsync(new LaunchOptions { Headless = false }); var page = await browser.NewPageAsync(); await page.GoToAsync("https://example.com/captcha-page"); var result = await captchaSolver.SolveCaptchaAsync(page); if (string.IsNullOrEmpty(result.Error)) { Console.WriteLine($"Successfully solved {result.Solved.Count} CAPTCHA(s)"); } else { Console.WriteLine($"Error: {result.Error}"); } ``` -------------------------------- ### Configuring CaptchaSolver Provider Options Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/PuppeteerExtraSharp/Plugins/CaptchaSolver/readme.md Demonstrates how to set specific options for the CAPTCHA solving provider, including the overall timeout, initial delay, and polling interval for checking solutions. ```csharp var providerOptions = new CaptchaProviderOptions { // Timeout for the entire solving operation (default: 5 minutes) Timeout = TimeSpan.FromMinutes(3), // Initial delay before checking for solution (default: 5 seconds) StartTimeout = TimeSpan.FromSeconds(3), // Polling interval to check for solution (default: 2 seconds) PollingInterval = TimeSpan.FromSeconds(2) }; var provider = new CapSolver("YOUR_API_KEY", providerOptions); var captchaSolver = new CaptchaSolverPlugin(provider); ``` -------------------------------- ### Initialize CaptchaSolverPlugin Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/configuration.md Instantiate CaptchaSolverPlugin with a captcha solver provider and optional configuration options. ```csharp public CaptchaSolverPlugin( ICaptchaSolverProvider provider, CaptchaOptions options = null) ``` -------------------------------- ### Configure StealthWebGLOptions Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/StealthPlugin.md Create StealthWebGLOptions to spoof WebGL vendor and renderer strings. ```csharp new StealthWebGLOptions("NVIDIA Corporation", "ANGLE (NVIDIA)") ``` -------------------------------- ### Implement Custom Rule Class Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/PuppeteerExtraSharp/Plugins/BlockResources/README.md Demonstrates how to create a custom rule by implementing the IBlockRule interface. This provides full control over the blocking logic, allowing for complex conditions based on request properties like URL and navigation status. The custom rule is then added to the plugin. ```csharp public class MyRule : IBlockRule { public bool ShouldBlock(IRequest request) { return request.IsNavigationRequest && request.Url.Contains("ads.js"); } } // Register your custom rule var blockResourcesPlugin = new BlockResourcesPlugin(); blockResourcesPlugin.AddRule(new MyRule()); ``` -------------------------------- ### PuppeteerExtraPlugin.AfterLaunchAsync Method Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtraPlugin.md Called immediately after browser launch. Useful for setting up browser-level listeners or initialization. ```APIDOC ## PuppeteerExtraPlugin.AfterLaunchAsync Method ### Description Called immediately after browser launch. Useful for setting up browser-level listeners or initialization. ### Method `protected internal virtual Task AfterLaunchAsync(IBrowser browser)` ### Parameters #### Path Parameters - **browser** (IBrowser) - Required - The launched browser instance ### Return Type `Task` — Completed task by default. ``` -------------------------------- ### Configure StealthLanguagesOptions Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/StealthPlugin.md Create StealthLanguagesOptions to set navigator.languages and navigator.language values. ```csharp new StealthLanguagesOptions("de-DE", "de") ``` -------------------------------- ### Initialize Stealth Plugin Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/PuppeteerExtraSharp/Plugins/ExtraStealth/readme.md Basic initialization of the Stealth plugin for PuppeteerExtraSharp. Use this for standard stealth capabilities. ```csharp var extra = new PuppeteerExtra(); // initialize stealth plugin var stealth = new StealthPlugin(); var browser = await extra.Use(stealth).LaunchAsync(new LaunchOptions()); var page = await browser.NewPageAsync(); await page.GoToAsync("https://bot.sannysoft.com/"); ``` -------------------------------- ### Instantiate CapSolver Provider Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/CaptchaSolverPlugin.md Initialize the CapSolver provider with your API key. This is used to authenticate with the CapSolver service. ```csharp public class CapSolver : ICaptchaSolverProvider { public CapSolver(string key, CaptchaProviderOptions options = null) } ``` ```csharp var provider = new CapSolver("your-capsolver-api-key"); var plugin = new CaptchaSolverPlugin(provider); ``` -------------------------------- ### PuppeteerExtra Constructor Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtra.md Initializes a new instance of the PuppeteerExtra class with an empty plugin list. ```APIDOC ## Constructor PuppeteerExtra ### Description Initializes a new instance with an empty plugin list. ### Method `PuppeteerExtra()` ### Example ```csharp var extra = new PuppeteerExtra(); ``` ``` -------------------------------- ### Instantiate and Use CaptchaSolverPlugin Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/CaptchaSolverPlugin.md Demonstrates how to create an instance of CaptchaSolverPlugin with a specific provider and options, and then add it to Puppeteer Extra. ```csharp var provider = new CapSolver("your-api-key"); var options = new CaptchaOptions(); var plugin = new CaptchaSolverPlugin(provider, options); var extra = new PuppeteerExtra(); extra.Use(plugin); ``` -------------------------------- ### PuppeteerExtraPlugin.BeforeLaunchAsync Method Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtraPlugin.md Called before browser launch, before any Puppeteer operations. Allows modification of launch options. ```APIDOC ## PuppeteerExtraPlugin.BeforeLaunchAsync Method ### Description Called before browser launch, before any Puppeteer operations. Allows modification of launch options. ### Method `protected internal virtual Task BeforeLaunchAsync(LaunchOptions options)` ### Parameters #### Path Parameters - **options** (LaunchOptions) - Required - Browser launch options that will be passed to Puppeteer.LaunchAsync ### Return Type `Task` — Completed task by default. ### Use Case Modify launch options, prepare plugin state. ### Example ```csharp protected internal override Task BeforeLaunchAsync(LaunchOptions options) { options.Args = options.Args.Append("--disable-features=IsolateOrigins").ToArray(); return Task.CompletedTask; } ``` ``` -------------------------------- ### PluginRequirements Enum Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/types.md Specifies browser environment requirements for plugins. Use 'Launch' if a plugin only works with LaunchAsync, 'HeadFul' for non-headless mode, and 'RunLast' to ensure it executes after others. ```csharp public enum PluginRequirements { Launch, // Plugin requires LaunchAsync, not ConnectAsync HeadFul, // Plugin requires headful (non-headless) mode RunLast // Plugin should execute after all other plugins } ``` -------------------------------- ### Plugin Validation with NotSupportedException Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/errors.md Demonstrates how to validate plugin compatibility by catching a NotSupportedException, which is thrown if incompatible plugins are used together. ```csharp try { var extra = new PuppeteerExtra(); extra.Use(new StealthPlugin()); extra.Use(new CustomHeadfulPlugin()); var browser = await extra.LaunchAsync(new LaunchOptions { Headless = true }); } catch (NotSupportedException ex) { Console.WriteLine($"Incompatible plugin: {ex.Message}"); } ``` -------------------------------- ### Add Options with ArgumentException Check Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/errors.md Provides the C# code for adding plugin options, including a check that throws an ArgumentException if an option of the same type already exists. This prevents duplicate configurations. ```csharp public void AddOptions(T options) where T : IPuppeteerExtraPluginOptions { if (_options.OfType().Any()) { throw new ArgumentException("Option already exists", nameof(options)); } _options.Add(options); } ``` -------------------------------- ### Initialize BlockResourcesPlugin Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/BlockResourcesPlugin.md Instantiate the BlockResourcesPlugin with custom abort error code and priority. Then, use the plugin with PuppeteerExtra. ```csharp var blockPlugin = new BlockResourcesPlugin( RequestAbortErrorCode.AccessDenied, priority: 100 ); var extra = new PuppeteerExtra(); extra.Use(blockPlugin); ``` -------------------------------- ### Initialize BlockResourcesPlugin Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/configuration.md Instantiate BlockResourcesPlugin with optional error code and priority. ```csharp public BlockResourcesPlugin( RequestAbortErrorCode? abortErrorCode = null, int? priority = null) ``` -------------------------------- ### PuppeteerExtraPlugin Constructor Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtraPlugin.md Initializes a new instance of the PuppeteerExtraPlugin class with a unique plugin name. ```APIDOC ## PuppeteerExtraPlugin Constructor ### Description Initializes a new instance of the PuppeteerExtraPlugin class. ### Method `protected PuppeteerExtraPlugin(string pluginName)` ### Parameters #### Path Parameters - **pluginName** (string) - Required - Unique identifier for the plugin ``` -------------------------------- ### Per-Call Configuration for Error Handling Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/errors.md Shows how to configure error handling options on a per-call basis, allowing for different strategies like throwing exceptions or logging debug information for specific operations. ```csharp var plugin = extra.GetPlugin(); var throwingOptions = new CaptchaOptions { ThrowOnError = true }; var loggingOptions = new CaptchaOptions { Debug = true }; try { var result = await plugin.SolveCaptchaAsync(page, throwingOptions); } catch (CaptchaException ex) { var fallbackResult = await plugin.FindCaptchaAsync(page, loggingOptions); // Handle manually } ``` -------------------------------- ### StealthHardwareConcurrencyOptions Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/StealthPlugin.md Configuration class for setting the navigator.hardwareConcurrency value. ```APIDOC ## StealthHardwareConcurrencyOptions ### Description Configuration class used to set the `navigator.hardwareConcurrency` property, which reports the number of CPU cores available to the browser. Spoofing this value can help evade detection. ### Constructor Signature ```csharp public StealthHardwareConcurrencyOptions(int concurrency) ``` #### Parameters - **concurrency** (int) - Required - Number of CPU cores to report. ### Properties - **Concurrency** (int) - The configured number of CPU cores. ### Example ```csharp new StealthHardwareConcurrencyOptions(4) ``` ``` -------------------------------- ### StealthLanguagesOptions Constructor Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/configuration.md Create StealthLanguagesOptions to configure the navigator.language(s) property. Provide language codes in the desired order. ```csharp new StealthLanguagesOptions("de-DE", "de", "en-US") ``` -------------------------------- ### Configure ConnectOptions for Puppeteer Extra Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/configuration.md Connect to an existing browser instance using a WebSocket endpoint and optionally ignore HTTPS errors. ```csharp public class ConnectOptions { public string BrowserWSEndpoint { get; set; } // WebSocket endpoint public bool IgnoreHTTPSErrors { get; set; } // Ignore HTTPS errors } ``` ```csharp var connectOpts = new ConnectOptions { BrowserWSEndpoint = "ws://localhost:9222" }; var browser = await extra.ConnectAsync(connectOpts); ``` -------------------------------- ### Connect to Existing Browser Instance Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtra.md Connects to an existing browser instance using the remote debugging protocol. This method invokes 'BeforeConnectAsync' and 'AfterConnectAsync' on plugins and validates their requirements. ```csharp var options = new ConnectOptions { BrowserWSEndpoint = "ws://localhost:9222" }; var browser = await extra.ConnectAsync(options); ``` -------------------------------- ### ConnectAsync Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtra.md Connects to an existing browser instance using the remote debugging protocol, applying plugin lifecycle methods before and after connection. ```APIDOC ## ConnectAsync ### Description Connects to an existing browser instance via remote debugging protocol. ### Method `async Task ConnectAsync(ConnectOptions options)` ### Parameters #### Path Parameters - **options** (ConnectOptions) - Required - PuppeteerSharp connection configuration ### Return Type `Task` — Task resolving to an IBrowser instance. ### Behavior 1. Calls `BeforeConnectAsync()` on all plugins 2. Connects to browser via Puppeteer.ConnectAsync 3. Calls `AfterConnectAsync()` on all plugins 4. Registers event handlers for pages and targets 5. Validates plugin requirements (plugins requiring `PluginRequirements.Launch` will throw) ### Throws `NotSupportedException` — If a plugin requires launch-only features. ### Example ```csharp var options = new ConnectOptions { BrowserWSEndpoint = "ws://localhost:9222" }; var browser = await extra.ConnectAsync(options); ``` ``` -------------------------------- ### Instantiate TwoCaptcha Provider Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/CaptchaSolverPlugin.md Initialize the TwoCaptcha provider with your API key. This is used to authenticate with the 2Captcha service. ```csharp public class TwoCaptcha : ICaptchaSolverProvider { public TwoCaptcha(string key, CaptchaProviderOptions options = null) } ``` ```csharp var provider = new TwoCaptcha("your-2captcha-api-key"); var plugin = new CaptchaSolverPlugin(provider); ``` -------------------------------- ### AnonymizeUaPlugin Constructor Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/AnonymizeUaPlugin.md Initializes the AnonymizeUaPlugin with default anonymization settings. This includes removing 'HeadlessChrome' from the user agent and standardizing the platform information to Windows NT 10.0. ```APIDOC ## AnonymizeUaPlugin() ### Description Initializes the plugin with default anonymization (removes "HeadlessChrome", standardizes platform). ### Constructor ```csharp public AnonymizeUaPlugin() ``` ### Usage Example ```csharp var extra = new PuppeteerExtra(); extra.Use(new AnonymizeUaPlugin()); var browser = await extra.LaunchAsync(); ``` ``` -------------------------------- ### Initialize AnonymizeUaPlugin Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/AnonymizeUaPlugin.md Initializes the plugin with default anonymization settings. Use this when launching PuppeteerExtra. ```csharp var extra = new PuppeteerExtra(); extra.Use(new AnonymizeUaPlugin()); var browser = await extra.LaunchAsync(); ``` -------------------------------- ### Launch Browser and Verify Stealth Evasions Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/StealthPlugin.md Launches a browser instance using Puppeteer Extra with the StealthPlugin applied and navigates to a page. It then evaluates the navigator.webdriver property to confirm that the stealth evasion is active. ```csharp var browser = await extra.LaunchAsync(); var page = await browser.NewPageAsync(); await page.GoToAsync("https://example.com"); // Page now has stealth evasions applied var result = await page.EvaluateExpressionAsync("navigator.webdriver"); // result: undefined (property removed) ``` -------------------------------- ### CaptchaSolverPlugin Constructor Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/CaptchaSolverPlugin.md Initializes a new instance of the CaptchaSolverPlugin with a specified CAPTCHA solving provider and optional configuration options. ```APIDOC ## CaptchaSolverPlugin Constructor ### Description Initializes a new instance of the CaptchaSolverPlugin with a specified CAPTCHA solving provider and optional configuration options. ### Parameters #### Path Parameters - **provider** (ICaptchaSolverProvider) - Required - Solving service provider (CapSolver or TwoCaptcha) - **options** (CaptchaOptions) - Optional - Global configuration for captcha handling (Default options) ### Request Example ```csharp var provider = new CapSolver("your-api-key"); var options = new CaptchaOptions(); var plugin = new CaptchaSolverPlugin(provider, options); var extra = new PuppeteerExtra(); extra.Use(plugin); ``` ``` -------------------------------- ### CaptchaOptions Constructor Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/CaptchaSolverPlugin.md Initializes a new instance of the CaptchaOptions class with default configuration values. ```csharp public CaptchaOptions() ``` -------------------------------- ### Catch NotSupportedException Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/errors.md Demonstrates catching a NotSupportedException that occurs when a plugin's requirements conflict with the browser configuration, such as using a HeadFul plugin in headless mode. ```csharp var extra = new PuppeteerExtra(); var plugin = new CustomHeadfulPlugin(); // Requires PluginRequirements.HeadFul extra.Use(plugin); try { var browser = await extra.LaunchAsync(new LaunchOptions { Headless = true }); } catch (NotSupportedException ex) { Console.WriteLine(ex.Message); // "Plugin - custom is not supported in headless mode" } ``` -------------------------------- ### Mobile User Agent Simulation Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/AnonymizeUaPlugin.md Sets a completely custom user agent string to simulate a mobile device. This is useful for testing mobile-specific website behavior. ```csharp var plugin = new AnonymizeUaPlugin(); plugin.CustomizeUa(ua => "Mozilla/5.0 (Linux; Android 13) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Mobile Safari/537.36" ); extra.Use(plugin); ``` -------------------------------- ### Configure WebGL Options Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/PuppeteerExtraSharp/Plugins/ExtraStealth/readme.md Set custom WebGL vendor and renderer strings for the Stealth plugin. This is important for evading detection based on WebGL information. ```csharp var webGLVendor = "Intel Inc."; // your custom webGL vendor var render = "Intel Iris OpenGL Engine"; // your custom webGL renderer var languagesSettings = new StealthWebGLOptions(webGLVendor, render); ``` -------------------------------- ### CapSolver Provider Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/CaptchaSolverPlugin.md Initializes the CapSolver provider with your API key and optional configuration. ```APIDOC ## CapSolver Provider ### Description Initializes the CapSolver provider with your API key and optional configuration. ### Constructor ```csharp public CapSolver(string key, CaptchaProviderOptions options = null) ``` ### Parameters - **key** (string) - Required - Your CapSolver API key - **options** (CaptchaProviderOptions) - Optional - Timeout and polling configuration ``` -------------------------------- ### ResourcesBlockBuilder Methods Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/configuration.md Provides methods for fluent configuration of block rules. ```APIDOC ## ResourcesBlockBuilder Methods ### Description Fluent configuration for block rules. ### Methods - **Resources(params ResourceType[])**: Block specific resource types. Returns Builder. - **Page(IPage)**: Limit to specific page. Returns Builder. - **Url(string pattern)**: Match URL pattern. Returns Builder. - **Custom(Func)**: Custom predicate. Returns Builder. ### URL Pattern Syntax - `*` — match any sequence - `?` — match single character - `[abc]` — match character set - Literal characters match exactly ### Example ```csharp builder .Resources(ResourceType.Image, ResourceType.Script) .Url("*analytics*") .Custom(req => req.Method == HttpMethod.Post) ``` ``` -------------------------------- ### PuppeteerExtraPlugin Lifecycle Methods Signatures Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/api-reference/PuppeteerExtraPlugin.md Provides the method signatures for various lifecycle events in the PuppeteerExtraPlugin, including BeforeLaunchAsync, AfterLaunchAsync, BeforeConnectAsync, AfterConnectAsync, OnPageCreatedAsync, and OnTargetCreatedAsync. ```csharp protected internal virtual Task BeforeLaunchAsync(LaunchOptions options) ``` ```csharp protected internal virtual Task AfterLaunchAsync(IBrowser browser) ``` ```csharp protected internal virtual Task BeforeConnectAsync(ConnectOptions options) ``` ```csharp protected internal virtual Task AfterConnectAsync(IBrowser browser) ``` ```csharp protected internal virtual Task OnPageCreatedAsync(IPage page) ``` ```csharp protected internal virtual Task OnTargetCreatedAsync(Target target) ``` -------------------------------- ### Configuring CaptchaSolver Plugin with CaptchaOptions Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/PuppeteerExtraSharp/Plugins/CaptchaSolver/readme.md Illustrates how to customize the CaptchaSolver plugin's behavior using the CaptchaOptions class, including timeouts, error handling, score thresholds, and vendor enablement. ```csharp var options = new CaptchaSolverOptions { // Maximum time to wait for CAPTCHA to appear (default: 5 seconds) CaptchaWaitTimeout = TimeSpan.FromSeconds(10), // Throw exceptions on errors instead of returning error messages ThrowOnError = false, // Minimum acceptable score for score-based CAPTCHAs (0.0 - 1.0, default: 0.5) MinScore = 0.7, // Only solve CAPTCHAs visible in the viewport SolveInViewportOnly = false, // Solve score-based CAPTCHAs (like reCAPTCHA v3) SolveScoreBased = true, // Solve invisible CAPTCHAs with no active challenge SolveInactiveChallenges = true, // Solve invisible CAPTCHA challenges SolveInvisibleChallenges = true, // Enable debug logging Debug = false, // Control which vendors to handle EnabledVendors = new Dictionary { { CaptchaVendor.Google, new GoogleOptions() }, { CaptchaVendor.GeeTest, null }, { CaptchaVendor.Cloudflare, null }, { CaptchaVendor.HCaptcha, null }, { CaptchaVendor.DataDome, null } } }; var captchaSolver = new CaptchaSolverPlugin( new CapSolver("YOUR_API_KEY"), options ); ``` -------------------------------- ### Using 2Captcha Provider with CaptchaSolver Plugin Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/PuppeteerExtraSharp/Plugins/CaptchaSolver/readme.md Shows how to configure the CaptchaSolver plugin to use the 2Captcha service by providing your API key. ```csharp using PuppeteerExtraSharp.Plugins.CaptchaSolver.Providers.TwoCaptcha; var captchaSolver = new CaptchaSolverPlugin( new TwoCaptcha("YOUR_2CAPTCHA_API_KEY") ); ``` -------------------------------- ### Trigger NotSupportedException for Connect Mode Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/errors.md Shows the code that throws a NotSupportedException when a plugin requiring launch is used in connect mode. This ensures plugins are used in their intended browser connection types. ```csharp case StartType.Connect when requirement == PluginRequirements.Launch: throw new NotSupportedException( $"Plugin - {puppeteerExtraPlugin.Name} doesn't support connect"); ``` -------------------------------- ### IPuppeteerExtraPluginOptions Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/types.md Marker interface for plugin configuration. Used to type plugin options objects. ```APIDOC ## IPuppeteerExtraPluginOptions Marker interface for plugin configuration. **Source:** `PuppeteerExtraSharp/Plugins/PuppeteerExtraPluginOptions.cs` No methods. Used to type plugin options objects. **Implementations:** - `StealthLanguagesOptions` - `StealthWebGLOptions` - `StealthHardwareConcurrencyOptions` - `StealthVendorSettings` - `GoogleOptions` (deprecated) ``` -------------------------------- ### PluginRequirements Source: https://github.com/overmiind/puppeteer-sharp-extra/blob/master/_autodocs/types.md Browser environment requirements for a plugin, specifying if it needs launch, headful mode, or to run last. ```APIDOC ## PluginRequirements ### Description Browser environment requirements for a plugin. ### Values - **Launch** - Plugin requires LaunchAsync, not ConnectAsync - **HeadFul** - Plugin requires headful (non-headless) mode - **RunLast** - Plugin should execute after all other plugins ```