You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Run Playwright .NET tests with Microsoft Playwright Testing
2
+
3
+
This sample demonstrates how to run Playwright .NET to use browser at scale using Microsoft Playwright Testing. It showcases the benefits of accelerating test suite completion by leveraging more parallel cloud browsers. The tests are executed using dotnet library without Any runner.
4
+
5
+
If you have not yet created a workspace, please follow the [Get Started guide](../../../README.md#get-started)
1. Build the project so the playwright.ps1 is available inside the bin directory:
20
+
```powershell
21
+
dotnet build
22
+
```
23
+
24
+
1. Install required browsers by replacing netX with the actual output folder name, e.g. net6.0:
25
+
26
+
```powershell
27
+
pwsh bin/Debug/netX/playwright.ps1 install
28
+
```
29
+
30
+
If pwsh is not available, you have to [install PowerShell](https://docs.microsoft.com/powershell/scripting/install/installing-powershell).
31
+
32
+
33
+
1. Set up environment:
34
+
In the [Playwright portal](https://aka.ms/mpt/portal), copy the command under **Add region endpoint in your set up** and set the following environment variable:
35
+
36
+
```bash
37
+
PLAYWRIGHT_SERVICE_URL= # Paste region endpoint URL
38
+
```
39
+
- Generate access token following [guide](https://aka.ms/mpt/generate-access-token)
Run Playwright script against browsers managed by the service using the configuration you created above. You can run up to 50 parallel workers with the service
48
+
```powershell
49
+
dotnet run
50
+
```
51
+
52
+
53
+
## Next steps
54
+
1. Follow the [quickstart guide](https://learn.microsoft.com/en-us/azure/playwright-testing/quickstart-run-end-to-end-tests?tabs=playwrightcli&pivots=nunit-test-runner)
0 commit comments