playwright-dotnet icon indicating copy to clipboard operation
playwright-dotnet copied to clipboard

.NET version of the Playwright testing and automation library.

Playwright for .NET 🎭

NuGet version Join Slack

Linux macOS Windows
Chromium 105.0.5195.19
WebKit 16.0
Firefox 103.0

Playwright for .NET is the official language port of Playwright, the library to automate Chromium, Firefox and WebKit with a single API. Playwright is built to enable cross-browser web automation that is ever-green, capable, reliable and fast.

Documentation

https://playwright.dev/dotnet/docs/intro

API Reference

https://playwright.dev/dotnet/docs/api/class-playwright

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

class Program
{
    public static async Task Main()
    {
        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" });
    }
}

Other languages

More comfortable in another programming language? Playwright is also available in