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.
Showing the top 20 packages that depend on PuppeteerSharp.
| Packages | Downloads |
|---|---|
|
PuppeteerExtraSharp
Package Description
|
3 |
|
PuppeteerExtraSharp
Package Description
|
6 |
|
PuppeteerExtraSharp
Package Description
|
11 |
|
PuppeteerExtraSharp
Package Description
|
12 |
|
PuppeteerExtraSharp
Package Description
|
13 |
|
PuppeteerExtraSharp
Package Description
|
25 |
|
PuppeteerExtraSharp
Puppeteer extra sharp is a .NET port of the Node.js library
|
12 |
.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.0.0 | 1 | 12.02.2026 |
| 20.2.6 | 1 | 09.02.2026 |
| 20.2.5 | 3 | 17.12.2025 |
| 20.2.4 | 5 | 25.10.2025 |
| 20.2.2 | 7 | 03.08.2025 |
| 20.2.1 | 7 | 03.08.2025 |
| 20.2.0 | 8 | 03.08.2025 |
| 20.1.3 | 15 | 14.03.2025 |
| 20.1.2 | 9 | 14.03.2025 |
| 20.1.1 | 13 | 18.02.2025 |
| 20.1.0 | 15 | 08.02.2025 |
| 20.0.5 | 14 | 03.01.2025 |
| 20.0.4 | 14 | 24.01.2025 |
| 20.0.3 | 12 | 23.01.2025 |
| 20.0.2 | 12 | 24.01.2025 |
| 20.0.1-beta1 | 12 | 23.01.2025 |
| 20.0.0 | 12 | 23.01.2025 |
| 19.0.2 | 14 | 03.01.2025 |
| 19.0.1 | 12 | 24.01.2025 |
| 19.0.0 | 14 | 23.01.2025 |
| 19.0.0-beta2 | 12 | 24.01.2025 |
| 19.0.0-beta1 | 12 | 23.01.2025 |
| 18.1.0 | 13 | 23.01.2025 |
| 18.1.0-beta1 | 9 | 14.03.2025 |
| 18.0.5 | 12 | 23.01.2025 |
| 18.0.4 | 13 | 17.01.2025 |
| 18.0.3 | 12 | 24.01.2025 |
| 18.0.2 | 12 | 23.01.2025 |
| 18.0.1 | 14 | 24.01.2025 |
| 18.0.0 | 11 | 23.01.2025 |
| 17.0.0 | 13 | 24.01.2025 |
| 16.0.0 | 13 | 24.01.2025 |
| 15.1.0 | 11 | 23.01.2025 |
| 15.0.0 | 12 | 23.01.2025 |
| 14.1.0 | 12 | 24.01.2025 |
| 14.0.0 | 12 | 23.01.2025 |
| 13.0.2 | 12 | 12.01.2025 |
| 13.0.1 | 14 | 24.01.2025 |
| 13.0.0 | 12 | 24.01.2025 |
| 12.0.0 | 17 | 03.01.2025 |
| 11.0.6 | 12 | 24.01.2025 |
| 11.0.5 | 12 | 23.01.2025 |
| 11.0.4 | 12 | 23.01.2025 |
| 11.0.3 | 12 | 24.01.2025 |
| 11.0.2 | 12 | 23.01.2025 |
| 11.0.1 | 12 | 18.02.2025 |
| 11.0.0 | 12 | 23.01.2025 |
| 10.1.4 | 11 | 23.01.2025 |
| 10.1.2 | 12 | 23.01.2025 |
| 10.1.1 | 13 | 24.01.2025 |
| 10.1.0 | 12 | 23.01.2025 |
| 10.0.0 | 13 | 23.01.2025 |
| 9.1.0 | 12 | 23.01.2025 |
| 9.0.2 | 20 | 16.07.2024 |
| 9.0.1 | 13 | 23.01.2025 |
| 9.0.0 | 12 | 23.01.2025 |
| 8.0.0 | 13 | 17.01.2025 |
| 7.1.0 | 12 | 23.01.2025 |
| 7.0.0 | 12 | 24.01.2025 |
| 6.2.0 | 12 | 23.01.2025 |
| 6.1.0 | 12 | 23.01.2025 |
| 6.0.0 | 12 | 23.01.2025 |
| 5.1.0 | 14 | 23.01.2025 |
| 5.0.0 | 12 | 23.01.2025 |
| 4.0.0 | 12 | 23.01.2025 |
| 3.0.0 | 14 | 23.01.2025 |
| 2.0.4 | 10 | 14.03.2025 |
| 2.0.3 | 12 | 29.01.2025 |
| 2.0.2 | 12 | 18.02.2025 |
| 2.0.1 | 11 | 23.01.2025 |
| 2.0.0 | 13 | 24.01.2025 |
| 1.20.0 | 9 | 14.03.2025 |
| 1.20.0-alpha | 12 | 23.01.2025 |
| 1.19.0 | 14 | 23.01.2025 |
| 1.18.0 | 14 | 24.01.2025 |
| 1.17.2 | 12 | 31.01.2025 |
| 1.17.1 | 14 | 23.01.2025 |
| 1.17.0 | 12 | 23.01.2025 |
| 1.16.0 | 13 | 24.01.2025 |
| 1.15.0 | 12 | 23.01.2025 |
| 1.14.1 | 12 | 24.01.2025 |
| 1.14.0 | 12 | 23.01.2025 |
| 1.13.0 | 12 | 23.01.2025 |
| 1.12.1 | 13 | 24.01.2025 |
| 1.12.0 | 14 | 23.01.2025 |
| 1.11.2 | 12 | 15.01.2025 |
| 1.11.1 | 12 | 23.01.2025 |
| 1.11.0 | 12 | 23.01.2025 |
| 1.10.0 | 12 | 23.01.2025 |
| 1.9.0 | 12 | 23.01.2025 |
| 1.8.0 | 13 | 23.01.2025 |
| 1.7.0 | 14 | 24.01.2025 |
| 1.6.2 | 12 | 23.01.2025 |
| 1.6.0 | 14 | 24.01.2025 |
| 1.5.0 | 12 | 23.01.2025 |
| 1.4.0 | 15 | 23.01.2025 |
| 1.3.0 | 14 | 24.01.2025 |
| 1.2.0 | 14 | 23.01.2025 |
| 1.1.0 | 12 | 24.01.2025 |
| 1.0.2 | 14 | 23.01.2025 |
| 1.0.1 | 13 | 23.01.2025 |
| 1.0.0 | 13 | 24.01.2025 |
| 0.8.0 | 13 | 03.01.2025 |
| 0.7.0 | 12 | 23.01.2025 |
| 0.6.0 | 12 | 23.01.2025 |
| 0.5.0 | 12 | 23.01.2025 |
| 0.4.0 | 12 | 23.01.2025 |
| 0.3.3 | 14 | 24.09.2024 |
| 0.3.2 | 12 | 23.01.2025 |
| 0.3.1 | 12 | 23.01.2025 |
| 0.3.0 | 12 | 23.01.2025 |
| 0.1.1 | 12 | 24.01.2025 |
| 0.1.0 | 12 | 23.01.2025 |
| 0.0.1 | 12 | 23.01.2025 |