To run several PuppeteerSharp browsers at once, start an independent Puppeteer.LaunchAsync task for each worker and await them together with .NET’s Task.WhenAll. Give each process its own profile directory, limit the number of workers to protect the host, and dispose every browser even when a job fails. If you only need separate sessions rather than separate operating-system processes, one browser with multiple browser contexts may be a lighter option.
Choose between browser processes and browser contexts
“Multiple browsers” can mean either several Chrome or Firefox processes, or several isolated sessions managed by one process. The right choice depends on how much separation the work needs.
| Approach | Use it when | Trade-offs |
|---|---|---|
| Separate browser processes | Workers need process-level crash isolation, different launch arguments or browser binaries, or stronger separation of browser state. | Each worker launches and cleans up a process; startup and resource costs are greater than sharing a process. Use a distinct UserDataDir for each process when profiles are persistent. |
| One browser, multiple contexts | Workers need independent browser sessions but do not require separate OS processes or different launch configurations. | Contexts provide independent sessions, but they do not isolate crashes or resource use in the same way as separate processes. |
A newly launched browser has a default context. PuppeteerSharp describes browser contexts as independent browser sessions. Prefer separate processes when process-level isolation is part of the requirement; prefer contexts when session separation is enough and avoiding repeated process launches matters.
Run separate browser processes with Task.WhenAll
Download the browser executable before starting workers, then launch one browser per worker. This example accepts URLs as command-line arguments, bounds the number of simultaneous workers, assigns each process a unique temporary profile, and disposes the page and browser after the job. It writes each page’s HTML to the console; replace that return value with the work your application needs.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
using System.Collections.Concurrent;
using PuppeteerSharp;
if (args.Length == 0)
{
Console.Error.WriteLine("Usage: app <url> [url ...]");
return;
}
var urls = args;
var maxWorkers = Math.Min(4, urls.Length); // Set this for your host and workload.
// Ensure the browser executable is available before workers try to launch it.
await new BrowserFetcher().DownloadAsync();
using var slots = new SemaphoreSlim(maxWorkers);
var errors = new ConcurrentQueue<Exception>();
var jobs = urls.Select(async (url, workerId) =>
{
await slots.WaitAsync();
var profilePath = Path.Combine(
Path.GetTempPath(),
$"puppeteer-profile-{workerId}-{Guid.NewGuid():N}");
try
{
await using var browser = await Puppeteer.LaunchAsync(new LaunchOptions
{
Headless = true,
UserDataDir = profilePath
});
await using var page = await browser.NewPageAsync();
await page.GoToAsync(url);
var html = await page.GetContentAsync();
Console.WriteLine($"Completed {url}: {html.Length} characters of HTML");
return html;
}
catch (Exception ex)
{
errors.Enqueue(new InvalidOperationException($"Worker for {url} failed.", ex));
throw;
}
finally
{
slots.Release();
try
{
if (Directory.Exists(profilePath))
Directory.Delete(profilePath, recursive: true);
}
catch (IOException ex)
{
Console.Error.WriteLine($"Could not remove profile {profilePath}: {ex.Message}");
}
catch (UnauthorizedAccessException ex)
{
Console.Error.WriteLine($"Could not remove profile {profilePath}: {ex.Message}");
}
}
});
try
{
var results = await Task.WhenAll(jobs);
Console.WriteLine($"Finished {results.Length} jobs.");
}
catch
{
// WhenAll has completed all supplied tasks. Inspect each failure rather than
// assuming the first exception is the only worker that failed.
while (errors.TryDequeue(out var error))
Console.Error.WriteLine(error);
Environment.ExitCode = 1;
}
Use a current PuppeteerSharp package in a .NET console project. The code assumes its API provides the asynchronous BrowserFetcher.DownloadAsync, Puppeteer.LaunchAsync, IBrowser.NewPageAsync, and page navigation/content methods shown. Check the API reference for the package version you deploy if a method signature differs.
Why the profile is unique
Chrome-family browsers lock a user-data directory while a process is using it. PuppeteerSharp’s launcher checks whether the selected directory is already in use; two concurrent launches pointed at the same profile can fail. The per-worker path above avoids that collision and separates cookies and profile state. If your job does not need a persistent profile, a unique temporary directory is a safe default. Remove it only after the browser has been disposed; cleanup failures should be logged rather than obscuring the original job error.
Why the worker limit matters
Task.WhenAll coordinates asynchronous tasks; it does not impose a concurrency limit. The SemaphoreSlim ensures no more than maxWorkers jobs occupy the browser-launch and navigation section at once. In the sample, four is merely an adjustable starting value, not a PuppeteerSharp limit or a recommended capacity. Measure on the machine and workload you will actually run.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Use one browser with multiple contexts when process isolation is unnecessary
Contexts let one browser process serve several independent sessions, so each worker can keep its own cookies and session state without launching a new OS process. The API describes them as independent browser sessions; they are not equivalent to separate processes for crash isolation, memory containment, or launch configuration.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
The broad orchestration pattern is to launch one browser, create a context per worker, create that context’s page, run the job, and dispose the context. Use the context-creation and disposal methods supported by the PuppeteerSharp version in your project, since the available API signatures may vary. Do not share a page between concurrent workers. If one context’s work should not affect another, keep its page and browser state local to that context.
Choose contexts for session separation and lower process-start overhead. Choose independent browser processes when a crash, different flags, or different browser executable must not be shared across workers. Neither approach removes the need to bound concurrency: multiple contexts can still compete for CPU, memory, network, and disk resources.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Prepare the host and control the workload
Download once, not in every worker
Call BrowserFetcher.DownloadAsync() once during application startup, before creating workers, or otherwise ensure the required browser executable is present. BrowserFetcher manages browser download and cache behavior and can expose an executable path if your setup needs to select one. Downloading as part of every worker adds avoidable contention and makes failures harder to distinguish from navigation failures.
Use headless mode for unattended jobs
PuppeteerSharp controls Chrome and Firefox and supports both headless and headful operation. For background workers, Headless = true avoids requiring a visible browser window. On Linux, check that the host has the required libraries; headful operation also needs a suitable display setup. The project’s README points Linux users to Chromium troubleshooting guidance.
Set a measured concurrency limit
PuppeteerSharp does not publish a universal maximum number of simultaneous browsers or a benchmarked CPU and RAM budget. A page that runs heavy JavaScript or generates a PDF can consume a different amount of resources from a lightweight page load. Start with a conservative bounded worker count, then record and tune:
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
- Time spent launching a browser separately from navigation and page work.
- Worker failures, browser exit events, and timeouts.
- Host memory pressure and CPU saturation while the queue is active.
- Whether throughput improves when the worker limit changes, rather than simply increasing contention.
For long-running services, a bounded channel or a SemaphoreSlim can prevent an unbounded number of queued jobs from launching at once. Keep cancellation and job state local to each worker, and ensure the browser is closed on both success and failure. If the application needs to stop promptly, propagate its cancellation signal through the queue and the operations that support cancellation in the PuppeteerSharp version being used.
Handle failures without leaking browser processes
Task.WhenAll completes after all of its supplied tasks complete. If one task faults, the combined task faults too; other workers may still finish or fail. Catch errors at the worker boundary when you need URL-specific diagnostics, and still observe the aggregate operation as in the example. Do not assume a failed navigation automatically cleaned up the process: disposal belongs in await using or a finally path.
A production worker should log the URL or job identifier, worker identifier, elapsed time, and exception. Avoid logging sensitive query strings or authentication data. If a profile is intentionally persistent, do not delete it at the end of each job; instead, assign it to one owner and prevent concurrent processes from opening it.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesBest Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Troubleshoot common concurrency failures
| Symptom | Likely cause | What to do |
|---|---|---|
| Launch reports that the user-data directory is already in use | Concurrent processes are sharing a UserDataDir, or a previous process still owns it. |
Give each process a unique profile path. Confirm stale browser processes are closed before reusing a persistent profile. |
| Browser executable is missing or launch fails before navigation | The required browser build has not been downloaded or the configured executable path is wrong. | Run BrowserFetcher setup once before workers, and verify the executable location for the package and host. |
| Workers fail intermittently under load | The host may be overloaded, or launch and navigation failures are being conflated. | Reduce the bounded worker count, log launch and navigation stages separately, and monitor memory and browser exit events. |
| Headful browser fails on a Linux server | No display is available or required system libraries are missing. | Use headless mode for unattended work and verify the Linux dependencies and display setup for the chosen mode. |
| Temporary profile cannot be deleted | The browser still owns files in the directory, or the process lacks permission. | Dispose the browser before deletion, log cleanup failures, and check permissions. Do not let cleanup exceptions hide the original worker error. |
| One worker’s cookies or state appear in another | Pages or profiles are being shared across workers. | Keep pages worker-local and assign each process a unique profile; with one process, use separate contexts for independent sessions. |
Or skip the browser setup
If your goal is to capture website screenshots rather than run browser automation, ScreenshotNeo provides a screenshot API and MCP server for developers. One GET request returns an image or PDF; this cURL example saves a WebP screenshot:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options. Cookie banners, newsletter popups, and chat widgets are removed before the shot; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server lets AI agents use screenshot tools, and the free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots. Sign up for the free plan.
Frequently Asked Questions
Does Task.WhenAll make browser launches sequential or parallel?
It awaits the worker tasks together; each task can progress asynchronously. The semaphore in the example controls how many workers may proceed at a time.
Is there a published maximum number of concurrent PuppeteerSharp browsers?
No universal simultaneous-browser limit or CPU/RAM benchmark is established. Capacity depends on the host and the pages being processed.
Free tools Windows power users keep installed
One-click scans. No signup required.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

