DEV.co
Open-Source Testing · hardkoded

puppeteer-sharp

Puppeteer Sharp is a .NET library that automates Chrome and Chromium browsers, enabling headless operations like screenshots, PDF generation, and web scraping. It brings the popular Node.js Puppeteer API to C# developers with support for modern .NET versions and AOT compilation.

Source: GitHub — github.com/hardkoded/puppeteer-sharp
3.9k
GitHub stars
485
Forks
C#
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositoryhardkoded/puppeteer-sharp
Ownerhardkoded
Primary languageC#
LicenseMIT — OSI-approved
Stars3.9k
Forks485
Open issues9
Latest releasev25.3.1 (2026-07-03)
Last updated2026-07-03
Sourcehttps://github.com/hardkoded/puppeteer-sharp

What puppeteer-sharp is

A Chrome DevTools Protocol (CDP) client for .NET Standard 2.0+ and .NET 8, providing async/await-based browser automation with cross-platform support. Offers multiple NuGet packages (full, CDP-only for AOT, and ASP.NET Framework variant) with WebDriver BiDi and Firefox support introduced in recent versions.

Quickstart

Get the puppeteer-sharp source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/hardkoded/puppeteer-sharp.gitcd puppeteer-sharp# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Automated Web Testing & E2E Testing

Navigate pages, interact with DOM elements, and validate rendering in .NET test suites. Headless mode supports CI/CD pipelines for integration testing without GUI dependencies.

Server-Side PDF and Screenshot Generation

Generate PDFs and screenshots from HTML/web content within .NET applications. Useful for invoice generation, report rendering, and dynamic content capture in backend services.

Web Scraping & Crawling

Extract data from JavaScript-heavy SPAs where DOM rendering is required before parsing. Supports navigation waiting, selector polling, and function evaluation for complex extraction workflows.

Implementation considerations

  • Browser binary management: Use BrowserFetcher to download compatible Chrome/Chromium versions automatically or manage binaries externally in containerized deployments.
  • Async/await patterns required: API is fully async; integration into sync code requires ConfigureAwait(false) and careful task orchestration.
  • Resource lifecycle: Always use `await using` for browser and page objects to ensure proper cleanup and avoid memory leaks in long-running services.
  • Viewport and navigation timing: Set viewport before navigation and use appropriate WaitUntilNavigation strategies (Networkidle0, Networkidle2, DOMContentLoaded) for reliable rendering.
  • Remote browser connection: Supports WSS endpoints for remote browser instances, enabling distributed testing and cloud-based browser farms.

When to avoid it — and what to weigh

  • Windows-Only or Limited Infrastructure — Requires X-server on Linux and full Chrome/Chromium binary downloads. Not suitable for minimal resource environments or platforms where headless browser operation is restricted.
  • High-Volume Concurrent Browser Sessions at Scale — Each browser instance consumes significant memory and CPU. Requires careful resource pooling and orchestration; not optimized for thousands of simultaneous headless sessions.
  • Lightweight, Embedded Rendering Tasks — Overkill for simple HTML-to-image or lightweight parsing jobs. Consider lighter alternatives if full browser automation and JavaScript execution are not needed.
  • Legacy .NET Framework Projects Without AOT — While NetStandard 2.0 support exists, AOT compilation support is limited to .NET 8+. Full-featured support may require .NET Framework 4.6.1+ migration or significant adaptation.

License & commercial use

MIT License. Permissive OSI-compliant license allowing unrestricted use, modification, and distribution in proprietary and open-source projects.

MIT license permits commercial use without attribution requirement or restriction. No licensing fees, vendor lock-in, or usage limits. Review dependency licenses (Chrome/Chromium) for your distribution model; Chromium is open-source but subject to its own license terms.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityModerate
DEV.co fitGood
Assessment confidenceHigh
Security considerations

No published security audit or formal security policy mentioned in data. Consider: browser automation exposes the underlying Chromium process to JavaScript execution from visited pages; isolate browser instances if processing untrusted content. Use WSS (WebSocket Secure) for remote browser connections. No claims made about sandboxing strength; assume Chromium's native sandbox model applies.

Alternatives to consider

Selenium WebDriver (.NET)

Mature, multi-browser support (IE, Firefox, Safari). Heavier and synchronous by default; less developer-friendly but more battle-tested in enterprise test suites.

Playwright for .NET

Microsoft-backed, cross-browser (Chrome, Firefox, WebKit), modern async API similar to Puppeteer Sharp. Actively maintained; good documentation. Consider if standardizing on Playwright ecosystem.

HtmlAgilityPack + AngleSharp

Lightweight HTML parsing without browser automation. Suitable for static or simple DOM extraction; no JavaScript execution, much lower overhead.

Software development agency

Build on puppeteer-sharp with DEV.co software developers

Puppeteer Sharp powers headless testing, PDF generation, and web scraping in C#. Evaluate its fit for your infrastructure, resource constraints, and integration with your CI/CD pipeline. Devco can help architect and deploy scalable automation solutions.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

puppeteer-sharp FAQ

Does Puppeteer Sharp work with Firefox?
Yes, as of v21+. WebDriver BiDi support added for Firefox automation. Full feature parity with Chrome/Chromium may vary; check release notes for capability matrix.
Can I use Puppeteer Sharp in serverless/FaaS (AWS Lambda, Azure Functions)?
Possible but challenging. Browser binary size and cold-start latency are problematic. Remote browser connection (WSS) or pre-built Lambda layers required. AOT (.NET 8) may reduce package size.
How do I manage multiple concurrent browsers without memory exhaustion?
Implement connection pooling and recycling logic; limit concurrent instances via semaphores. Monitor memory; consider stateless page-per-request patterns or external browser services (Browserless, BrowserStack).
Is Puppeteer Sharp suitable for production PDF generation at scale?
Yes, if infrastructure is sized appropriately (dedicated machines or microservices). Monitor resource usage; use remote browser connections or load balancers for high throughput. Not ideal for sub-second latency requirements.

Custom software development services

DEV.co is a software development agency delivering custom software development services to companies building on open source. Our software developers and web developers design, integrate, and ship production systems — spanning web development, APIs, AI, data, and cloud. If puppeteer-sharp is part of your open-source testing roadmap, our team can implement, customize, migrate, and maintain it.

Need Production Browser Automation for Your .NET Stack?

Puppeteer Sharp powers headless testing, PDF generation, and web scraping in C#. Evaluate its fit for your infrastructure, resource constraints, and integration with your CI/CD pipeline. Devco can help architect and deploy scalable automation solutions.