PuppeteerSharp 21.1.1

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());

Support

If you have an issue or a question:

Contributing

Check out contributing guide to get an overview of Puppeteer Sharp development.

No packages depend on PuppeteerSharp.

.NET 10.0

.NET Standard 2.0

Version Downloads Last updated
24.40.0 2 2026/3/27
24.39.1 2 2026/3/27
24.39.0 1 2026/3/27
24.38.0 1 2026/3/27
21.1.1 1 2026/3/27
21.1.0 1 2026/3/27
21.0.1 1 2026/3/27
21.0.0 1 2026/3/27
20.2.6 1 2026/3/27
20.2.5 3 2026/1/28
20.2.4 3 2026/1/28
20.2.2 3 2026/1/28
20.2.1 3 2026/1/28
20.2.0 3 2026/1/28
20.1.3 4 2026/1/26
20.1.2 3 2026/1/28
20.1.1 3 2026/1/28
20.1.0 3 2026/1/28
20.0.5 3 2026/1/28
20.0.4 3 2026/1/28
20.0.3 3 2026/1/28
20.0.2 3 2026/1/28
20.0.1-beta1 3 2026/1/28
20.0.0 3 2026/1/28
19.0.2 3 2026/1/28
19.0.1 3 2026/1/28
19.0.0 3 2026/1/28
19.0.0-beta2 3 2026/1/28
19.0.0-beta1 3 2026/1/28
18.1.0 3 2026/1/28
18.1.0-beta1 3 2026/1/28
18.0.5 3 2026/1/28
18.0.4 2 2026/1/28
18.0.3 3 2026/1/28
18.0.2 3 2026/1/28
18.0.1 3 2026/1/28
18.0.0 3 2026/1/28
17.0.0 3 2026/1/28
16.0.0 3 2026/1/28
15.1.0 3 2026/1/28
15.0.0 3 2026/1/28
14.1.0 3 2026/1/28
14.0.0 3 2026/1/28
13.0.2 3 2026/1/28
13.0.1 3 2026/1/28
13.0.0 3 2026/1/28
12.0.0 3 2026/1/28
11.0.6 3 2026/1/28
11.0.5 3 2026/1/28
11.0.4 3 2026/1/28
11.0.3 3 2026/1/28
11.0.2 3 2026/1/28
11.0.1 3 2026/1/28
11.0.0 3 2026/1/28
10.1.4 3 2026/1/28
10.1.2 3 2026/1/28
10.1.1 3 2026/1/28
10.1.0 3 2026/1/28
10.0.0 3 2026/1/28
9.1.0 3 2026/1/28
9.0.2 3 2026/1/28
9.0.1 3 2026/1/28
9.0.0 3 2026/1/28
8.0.0 3 2026/1/28
7.1.0 3 2026/1/28
7.0.0 3 2026/1/28
6.2.0 3 2026/1/28
6.1.0 3 2026/1/28
6.0.0 3 2026/1/28
5.1.0 3 2026/1/28
5.0.0 3 2026/1/28
4.0.0 3 2026/1/28
3.0.0 3 2026/1/28
2.0.4 3 2026/1/28
2.0.3 3 2026/1/28
2.0.2 3 2026/1/28
2.0.1 3 2026/1/28
2.0.0 3 2026/1/28
1.20.0 3 2026/1/28
1.20.0-alpha 3 2026/1/28
1.19.0 3 2026/1/28
1.18.0 3 2026/1/28
1.17.2 3 2026/1/28
1.17.1 3 2026/1/28
1.17.0 3 2026/1/28
1.16.0 3 2026/1/28
1.15.0 3 2026/1/28
1.14.1 3 2026/1/28
1.14.0 3 2026/1/28
1.13.0 3 2026/1/28
1.12.1 3 2026/1/28
1.12.0 3 2026/1/28
1.11.2 3 2026/1/28
1.11.1 3 2026/1/28
1.11.0 3 2026/1/28
1.10.0 3 2026/1/28
1.9.0 3 2026/1/28
1.8.0 3 2026/1/28
1.7.0 3 2026/1/28
1.6.2 3 2026/1/28
1.6.0 3 2026/1/28
1.5.0 3 2026/1/28
1.4.0 3 2026/1/28
1.3.0 3 2026/1/28
1.2.0 3 2026/1/28
1.1.0 3 2026/1/28
1.0.2 3 2026/1/28
1.0.1 3 2026/1/28
1.0.0 3 2026/1/28
0.8.0 3 2026/1/28
0.7.0 3 2026/1/28
0.6.0 3 2026/1/28
0.5.0 3 2026/1/28
0.4.0 3 2026/1/28
0.3.3 3 2026/1/28
0.3.2 3 2026/1/28
0.3.1 3 2026/1/28
0.3.0 3 2026/1/28
0.1.1 3 2026/1/28
0.1.0 3 2026/1/28
0.0.1 3 2026/1/28