Library / SDK
microsoft/playwright-dotnet avatar
microsoft/playwright-dotnet

Playwright for .NET: cross-browser automation from C#

.NET version of the Playwright testing and automation library.

3,014 stars305 forksC#MIT

At a glance

What is it?
Playwright for .NET is Microsoft's official C# port of Playwright, automating Chromium, Firefox and WebKit behind one API. It fits .NET teams that want browser tests in the same language as their application, and it costs anyone who needs a frozen, versioned toolchain.
Who is it for?
Adopt Playwright for .NET if your tests already live in a .NET solution and you want Chromium, Firefox and WebKit driven from one C# API without leaving the dotnet test runner. Do not adopt it if you need a browser matrix you pin and freeze, because the README ties each release to specific Chromium, WebKit and Firefox builds and the project describes the library as ever-green.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 6 days ago.
What is it written in?
Mainly C#, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 30, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What Playwright for .NET solves, and for whom

Browser automation in .NET has usually meant either Selenium WebDriver plus a driver binary per browser, or a pile of HTTP calls that never render JavaScript. Playwright for .NET takes a third route: a single C# API that drives Chromium, Firefox and WebKit, with the browser binaries managed by the library rather than by you. The README states it plainly: it is "the official language port of Playwright, the library to automate Chromium, Firefox and WebKit with a single API."

The audience is narrow and identifiable. If your application, your test project and your CI pipeline are already .NET, adding a Node-based or Python-based automation stack means a second toolchain, a second dependency manager and a second set of CI steps. Playwright for .NET keeps the whole thing inside NuGet and dotnet test. The README also lists TypeScript, Python and Java ports, so the C# package is a port rather than the reference implementation, and feature parity flows from the upstream project.

What it is not is a scraping framework or a load-testing tool. It is a browser driver with an assertion-friendly API surface, and the documentation points to xUnit, NUnit and MSTest style usage through the Microsoft.Playwright.NUnit and Microsoft.Playwright.MSTest packages referenced on the docs site.

How the C# API drives three browser engines

The architecture visible in the README is a two-layer one. Your C# code talks to Microsoft.Playwright, which spawns and speaks to a browser process over a driver protocol. You never construct a WebDriver session or manage a chromedriver executable; the library owns that lifecycle.

The README's own example shows the shape of it. Playwright.CreateAsync() returns the entry point, and from there you reach Chromium, Firefox or WebKit as properties on the same object. Because the API is identical across the three, a test written against Chromium runs against WebKit by changing one call. That is the whole value proposition, and it is why the README describes the library as cross-browser rather than browser-specific.

Browser versions are pinned per release. The compatibility table in the README lists Chromium 153.0.8010.12, WebKit 26.6 and Firefox 155.0, all three marked as supported on Linux, macOS and Windows. Those numbers are generated into the README, which means each Playwright for .NET release carries a specific browser set rather than whatever is installed on the machine. The README calls the project ever-green, which is accurate in the sense that releases track browser updates, and also the source of the main upgrade cost discussed below.

Installing from NuGet and taking a first screenshot

The package is Microsoft.Playwright on NuGet, and the README's badge links to that package page. The README does not spell out a full install sequence beyond the package reference, so the following follows the documented API rather than an install walkthrough.

Add the package to a console or test project. The README does not document a specific version to pin, so use the current release from NuGet.

bash
dotnet add package Microsoft.Playwright

After the package is restored, the browser binaries still have to be fetched. The Playwright docs describe a CLI step, and the repository ships a build.sh at the top level, but the README itself does not show the install command. Treat the browser install as a separate step you verify in your own environment rather than something the README guarantees.

The README gives this complete example, which launches Chromium with a visible window, opens the .NET docs page and writes a PNG:

cs
using System.Threading.Tasks;
using Microsoft.Playwright;

using var playwright = await Playwright.CreateAsync();
await using var browser = await playwright.Chromium.LaunchAsync(new() { Headless = false });
var page = await browser.NewPageAsync();
await page.GotoAsync("https://playwright.dev/dotnet");
await page.ScreenshotAsync(new() { Path = "screenshot.png" });

Run it and you should see a browser window open, navigate, and a screenshot.png appear in the working directory. Note the two disposal styles: playwright uses using, browser uses await using, because browser disposal is asynchronous. Getting that wrong leaves orphaned browser processes behind, which is the first thing to check if a test run hangs.

Where the ever-green model costs you

The pinned browser versions in the README are a feature and a liability at once. Chromium 153.0.8010.12, WebKit 26.6 and Firefox 155.0 are what a given release ships. When a new Playwright for .NET release lands, the browser set moves with it. In a repository that produces releases on the cadence suggested by v1.61.0 in June 2026, v1.62.0 in August 2026 and v1.63.0 in September 2026, that is a browser upgrade roughly every one to two months.

For a team that treats test infrastructure as something to freeze, this is friction. A green suite can go red after a package bump with no application change, because the underlying browser changed. The README offers no rollback guidance and no long-term support branch; ROLLING.md at the repository root is the only file whose name hints at the policy, and the README does not describe it.

The second limitation is WebKit. The README marks WebKit as supported on Linux, macOS and Windows, but WebKit on Linux is not the same engine build as Safari on macOS, so passing WebKit tests is not a Safari compatibility guarantee. Teams that read the matrix as "Safari is covered" are reading more into it than the table says.

Third, the README does not document container or headless-server setup. The related searches show people looking for a Playwright .NET Docker image, and the README does not mention one. If your CI runs in a minimal container, the browser dependencies are your problem to solve, not something the README addresses.

Playwright for .NET against Selenium WebDriver

The obvious alternative is Selenium WebDriver with its .NET bindings. The difference is architectural, not cosmetic. Selenium talks to a browser through a standardized WebDriver protocol and expects you to supply and version a driver binary per browser. Playwright for .NET ships its own driver and its own browser builds, and exposes one API object across all three engines.

That changes failure modes. With Selenium, a browser auto-update that outpaces your driver is a classic breakage, and the fix is a driver bump. With Playwright for .NET, the browser and the driver move together inside the package, so the breakage mode shifts to the package upgrade itself. Neither is strictly better; they fail in different places.

The API style also differs. Selenium's element model is find-then-act, and waits are explicit. Playwright's API, as the README example shows, is async throughout: GotoAsync, ScreenshotAsync, LaunchAsync. .NET developers comfortable with async/await will find that natural. Teams with a large existing Selenium page-object suite face a rewrite rather than a migration, because the abstractions do not map one to one.

A third option worth naming is using the TypeScript or Python Playwright directly and calling it from your pipeline as a separate step. That keeps you on the reference implementation and avoids port lag, at the cost of a second language in the repository.

Licence, releases and what upgrading actually involves

The repository is MIT licensed, and the LICENSE file sits at the top level. MIT is permissive: you can use the package in commercial and closed-source projects, and you carry the usual obligation to preserve the copyright notice and licence text for the portions you redistribute. That is a general description of the licence, not legal advice, and the LICENSE file is the authoritative text.

The upgrade cost is dominated by the browser pinning. Moving from one Playwright for .NET release to the next moves the Chromium, WebKit and Firefox versions listed in the README, so the practical upgrade procedure is: bump the package, re-run the suite, and expect some selector or timing churn. The README does not describe a deprecation window or a supported-versions policy, and the release notes are not reproduced in the repository README, so you cannot tell from the README alone which releases are still supported.

Maintenance signals are good on the surface. The repository is not archived, and the last push was on 2026-09-22, two days before this writing. The most recent release, v1.63.0, is dated 2026-09-21. Those are facts about activity, not a statement about support commitments, and the README does not make a support commitment.

Practical constraints before you commit

Test parallelism is the constraint most teams hit second, after browser install. The related searches include "playwright dotnet parallel", and parallel execution interacts with fixtures and with how many browser processes a CI runner can host. The README does not cover parallel configuration; that lives in the docs site and in the NUnit and MSTest integration packages.

Headless versus headed matters for debugging. The README example sets Headless = false explicitly, which is the right default when you are writing your first test and the wrong default in CI. Flipping it is a one-property change, but forgetting it in a pipeline produces a browser that cannot start on a machine with no display.

Finally, the .NET version matters. The related searches include "playwright dotnet 10", and the repository has a Directory.Build.props at the root that governs target frameworks for the build. The README does not state a minimum supported .NET version, so check the package page and that file rather than assuming your runtime is covered.

Editorial conclusion

Adopt Playwright for .NET if your tests already live in a .NET solution and you want Chromium, Firefox and WebKit driven from one C# API without leaving the dotnet test runner. Do not adopt it if you need a browser matrix you pin and freeze, because the README ties each release to specific Chromium, WebKit and Firefox builds and the project describes the library as ever-green. Before committing, verify that your CI image can run the browsers your tests need on Linux, and check which Microsoft.Playwright package version your SDK and test framework combination resolves to.

Frequently asked questions

Can I use Playwright with C#?

Yes. Playwright for .NET is the official C# port, published as the Microsoft.Playwright package on NuGet, and the README shows a complete C# example that launches Chromium and takes a screenshot.

Is Playwright going to replace Selenium?

The README makes no claim about replacing Selenium. It presents Playwright for .NET as an official language port that automates Chromium, Firefox and WebKit through a single API, and lists TypeScript, Python and Java as the other ports.

What are the disadvantages of using Playwright?

The README does not list disadvantages. Two constraints follow from what it does document: each release pins specific Chromium, WebKit and Firefox versions, so upgrading the package moves the browser set, and the README gives no rollback or support-window guidance.

Is Playwright better than Selenium?

The README does not compare the two. The documented difference is that Playwright for .NET drives Chromium, Firefox and WebKit through one API with its own browser builds, while the README says nothing about how that compares to WebDriver-based tooling.

Official sources

  1. License: MIT
  2. microsoft/playwright-dotnet on GitHub
  3. Project website
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/microsoft-playwright-dotnet.svg)](https://hysenlabs.com/projects/microsoft-playwright-dotnet)