PuppeteerSharp 21.0.0
Puppeteer Sharp
Puppeteer Sharp is a .NET port of the official Node.JS Puppeteer API.
What is Puppeteer Sharp?
Puppeteer Sharp provides a high-level API to control headless Chrome or Chromium over the DevTools Protocol. It can also be configured to use full (non-headless) Chrome or Chromium.
What can you do?
Most things that you can do manually in the browser can be done using Puppeteer Sharp! Here are a few examples:
- Generate screenshots and PDFs of pages
- Crawl a SPA (Single-Page Application) and generate pre-rendered content (i.e. "SSR" (Server-Side Rendering))
- Automate form submission, UI testing, keyboard input, etc.
- Create an up-to-date, automated testing environment
- Capture a timeline trace of your site to help diagnose performance issues
- Test Chrome Extensions
Prerequisites
- Puppeteer-Sharp comes in two flavors: a NetStandard 2.0 library for .NET Framework 4.6.1 and .NET Core 2.0 or greater and a .NET 8 version.
- If you have issues running Chrome on Linux, the Puppeteer repo has a great troubleshooting guide.
- X-server is required on Linux.
Usage
Take screenshots
var browserFetcher = new BrowserFetcher();
await browserFetcher.DownloadAsync();
await using var browser = await Puppeteer.LaunchAsync(
new LaunchOptions { Headless = true });
await using var page = await browser.NewPageAsync();
await page.GoToAsync("http://www.google.com");
await page.ScreenshotAsync(outputFile);
Generate PDF files
var browserFetcher = new BrowserFetcher();
await browserFetcher.DownloadAsync();
await using var browser = await Puppeteer.LaunchAsync(new LaunchOptions { Headless = true });
await using var page = await browser.NewPageAsync();
await page.GoToAsync("http://www.google.com");
await page.EvaluateExpressionHandleAsync("document.fonts.ready"); // Wait for fonts to be loaded
await page.PdfAsync(outputFile);
Evaluate Javascript
await using var page = await browser.NewPageAsync();
var seven = await page.EvaluateExpressionAsync<int>("4 + 3");
var someObject = await page.EvaluateFunctionAsync<JsonElement>("(value) => ({a: value})", 5);
Console.WriteLine(someObject.GetProperty("a").GetString());
Useful links
Support
If you have an issue or a question:
- Ask a question on Stack Overflow
- File a new issue
Contributing
Check out contributing guide to get an overview of Puppeteer Sharp development.
No packages depend on PuppeteerSharp.
.NET 8.0
- Microsoft.Extensions.Logging (>= 8.0.0)
- WebDriverBiDi-Relaxed (>= 0.0.40-beta-7)
.NET Standard 2.0
- Microsoft.Bcl.AsyncInterfaces (>= 10.0.0)
- Microsoft.Extensions.Logging (>= 8.0.0)
- System.Text.Json (>= 10.0.0)
- WebDriverBiDi-Relaxed (>= 0.0.40-beta-7)
| Version | Downloads | Last updated |
|---|---|---|
| 21.1.0 | 0 | 02/18/2026 |
| 21.0.1 | 1 | 02/14/2026 |
| 21.0.0 | 1 | 02/14/2026 |
| 20.2.6 | 3 | 02/14/2026 |
| 20.2.5 | 6 | 12/14/2025 |
| 20.2.4 | 9 | 10/14/2025 |
| 20.2.2 | 10 | 08/28/2025 |
| 20.2.1 | 9 | 09/14/2025 |
| 20.2.0 | 10 | 07/10/2025 |
| 20.1.3 | 12 | 03/25/2025 |
| 20.1.2 | 11 | 06/09/2025 |
| 20.1.1 | 12 | 06/09/2025 |
| 20.1.0 | 12 | 06/09/2025 |
| 20.0.5 | 10 | 06/09/2025 |
| 20.0.4 | 11 | 06/09/2025 |
| 20.0.3 | 11 | 06/09/2025 |
| 20.0.2 | 11 | 06/09/2025 |
| 20.0.1-beta1 | 11 | 06/09/2025 |
| 20.0.0 | 11 | 06/09/2025 |
| 19.0.2 | 11 | 06/09/2025 |
| 19.0.1 | 11 | 06/09/2025 |
| 19.0.0 | 12 | 06/09/2025 |
| 19.0.0-beta2 | 12 | 06/09/2025 |
| 19.0.0-beta1 | 13 | 06/13/2025 |
| 18.1.0 | 11 | 06/09/2025 |
| 18.1.0-beta1 | 11 | 06/09/2025 |
| 18.0.5 | 11 | 06/09/2025 |
| 18.0.4 | 11 | 06/12/2025 |
| 18.0.3 | 10 | 06/09/2025 |
| 18.0.2 | 11 | 06/09/2025 |
| 18.0.1 | 11 | 06/09/2025 |
| 18.0.0 | 10 | 06/09/2025 |
| 17.0.0 | 12 | 06/09/2025 |
| 16.0.0 | 11 | 06/09/2025 |
| 15.1.0 | 12 | 06/09/2025 |
| 15.0.0 | 12 | 06/09/2025 |
| 14.1.0 | 11 | 06/09/2025 |
| 14.0.0 | 10 | 06/09/2025 |
| 13.0.2 | 10 | 06/09/2025 |
| 13.0.1 | 10 | 06/09/2025 |
| 13.0.0 | 11 | 06/11/2025 |
| 12.0.0 | 12 | 06/11/2025 |
| 11.0.6 | 11 | 06/09/2025 |
| 11.0.5 | 11 | 06/09/2025 |
| 11.0.4 | 11 | 06/09/2025 |
| 11.0.3 | 10 | 06/09/2025 |
| 11.0.2 | 10 | 06/09/2025 |
| 11.0.1 | 10 | 06/09/2025 |
| 11.0.0 | 11 | 06/09/2025 |
| 10.1.4 | 10 | 06/09/2025 |
| 10.1.2 | 11 | 06/09/2025 |
| 10.1.1 | 12 | 06/09/2025 |
| 10.1.0 | 10 | 06/11/2025 |
| 10.0.0 | 11 | 06/09/2025 |
| 9.1.0 | 10 | 06/09/2025 |
| 9.0.2 | 10 | 06/09/2025 |
| 9.0.1 | 12 | 06/09/2025 |
| 9.0.0 | 9 | 06/09/2025 |
| 8.0.0 | 9 | 06/09/2025 |
| 7.1.0 | 10 | 06/09/2025 |
| 7.0.0 | 10 | 06/11/2025 |
| 6.2.0 | 10 | 06/09/2025 |
| 6.1.0 | 10 | 06/09/2025 |
| 6.0.0 | 10 | 06/09/2025 |
| 5.1.0 | 10 | 06/09/2025 |
| 5.0.0 | 10 | 06/09/2025 |
| 4.0.0 | 9 | 06/09/2025 |
| 3.0.0 | 10 | 06/09/2025 |
| 2.0.4 | 10 | 06/09/2025 |
| 2.0.3 | 11 | 06/11/2025 |
| 2.0.2 | 10 | 06/09/2025 |
| 2.0.1 | 9 | 06/09/2025 |
| 2.0.0 | 10 | 06/09/2025 |
| 1.20.0 | 12 | 06/09/2025 |
| 1.20.0-alpha | 13 | 05/29/2025 |
| 1.19.0 | 12 | 06/09/2025 |
| 1.18.0 | 12 | 06/11/2025 |
| 1.17.2 | 13 | 06/11/2025 |
| 1.17.1 | 11 | 06/09/2025 |
| 1.17.0 | 11 | 06/09/2025 |
| 1.16.0 | 11 | 06/11/2025 |
| 1.15.0 | 11 | 06/11/2025 |
| 1.14.1 | 11 | 06/09/2025 |
| 1.14.0 | 11 | 06/09/2025 |
| 1.13.0 | 11 | 06/09/2025 |
| 1.12.1 | 12 | 06/09/2025 |
| 1.12.0 | 10 | 06/09/2025 |
| 1.11.2 | 11 | 06/09/2025 |
| 1.11.1 | 11 | 06/09/2025 |
| 1.11.0 | 10 | 06/09/2025 |
| 1.10.0 | 10 | 06/09/2025 |
| 1.9.0 | 11 | 06/09/2025 |
| 1.8.0 | 11 | 06/09/2025 |
| 1.7.0 | 10 | 06/09/2025 |
| 1.6.2 | 11 | 06/09/2025 |
| 1.6.0 | 10 | 06/09/2025 |
| 1.5.0 | 12 | 06/09/2025 |
| 1.4.0 | 11 | 06/09/2025 |
| 1.3.0 | 11 | 06/09/2025 |
| 1.2.0 | 11 | 06/09/2025 |
| 1.1.0 | 10 | 06/09/2025 |
| 1.0.2 | 9 | 06/09/2025 |
| 1.0.1 | 9 | 06/09/2025 |
| 1.0.0 | 9 | 06/09/2025 |
| 0.8.0 | 11 | 06/09/2025 |
| 0.7.0 | 10 | 06/09/2025 |
| 0.6.0 | 11 | 06/09/2025 |
| 0.5.0 | 9 | 06/09/2025 |
| 0.4.0 | 11 | 06/09/2025 |
| 0.3.3 | 10 | 06/09/2025 |
| 0.3.2 | 11 | 06/09/2025 |
| 0.3.1 | 10 | 06/09/2025 |
| 0.3.0 | 10 | 06/09/2025 |
| 0.1.1 | 11 | 06/09/2025 |
| 0.1.0 | 9 | 06/09/2025 |
| 0.0.1 | 9 | 06/09/2025 |