Start with installing
playwright dotnet tool globally. This only needs to be done once. Learn more about Playwright CLI tool.
Create a console project and add the Playwright dependency.
Program.cs that will navigate to
https://playwright.dev/dotnet and take a screenshot in Chromium.
Now run it.
By default, Playwright runs the browsers in headless mode. To see the browser UI, pass the
Headless = false flag while launching the browser. You can also use
slowMo to slow down execution. Learn more in the debugging tools section.
You can choose to use NUnit test fixtures that come bundled with Playwright. These fixtures support running tests on multiple browser engines in parallel, out of the box. Learn more about Playwright with NUnit.
Install dependencies, build project and download necessary browsers. This is only done once per project.
Edit UnitTest1.cs file.
Command Line Interface can be used to record user interactions and generate C# code.
The browser binaries for Chromium, Firefox and WebKit work across the 3 platforms (Windows, macOS, Linux):
Works with Windows and Windows Subsystem for Linux (WSL).
Requires 10.14 (Mojave) or above.
Depending on your Linux distribution, you might need to install additional dependencies to run the browsers.
Only Ubuntu 18.04 and Ubuntu 20.04 are officially supported.
See also in the Command Line Interface which has a command to install all necessary dependencies automatically for Ubuntu LTS releases.