docs(.net): update installation docs (#10796)

This commit is contained in:
Pavel Feldman 2021-12-08 11:07:01 -08:00 committed by GitHub
parent cfd4404756
commit ce56d7d10b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 17 deletions

View File

@ -98,7 +98,7 @@ playwright install --help
```
```bash csharp
playwright install --help
bin\Debug\netX\playwright.ps1 install --help
```
## Generate code
@ -116,7 +116,7 @@ playwright codegen wikipedia.org
```
```bash csharp
playwright codegen wikipedia.org
bin\Debug\netX\playwright.ps1 codegen wikipedia.org
```
Run `codegen` and perform actions in the browser. Playwright CLI will generate JavaScript code for the user interactions. `codegen` will attempt to generate resilient text-based selectors.
@ -146,7 +146,7 @@ playwright codegen --save-storage=auth.json
```
```bash csharp
playwright codegen --save-storage=auth.json
bin\Debug\netX\playwright.ps1 codegen --save-storage=auth.json
# Perform authentication and exit.
# auth.json will contain the storage state.
```
@ -173,7 +173,7 @@ playwright codegen --load-storage=auth.json my.web.app
```
```bash csharp
playwright open --load-storage=auth.json my.web.app
bin\Debug\netX\playwright.ps1 open --load-storage=auth.json my.web.app
playwright codegen --load-storage=auth.json my.web.app
# Perform actions in authenticated state.
```
@ -581,5 +581,5 @@ playwright install-deps chromium
```
```bash csharp
playwright install-deps chromium
bin\Debug\netX\playwright.ps1 install-deps chromium
```

View File

@ -6,14 +6,6 @@ title: "Getting started"
<!-- TOC -->
- [Release notes](./release-notes.md)
## Installation
Start with installing `playwright` dotnet tool globally. This only needs to be done once. Learn more about [Playwright CLI](./cli.md) tool.
```bash
dotnet tool install --global Microsoft.Playwright.CLI
```
## First project
Create a console project and add the Playwright dependency.
@ -23,10 +15,12 @@ Create a console project and add the Playwright dependency.
dotnet new console -n PlaywrightDemo
cd PlaywrightDemo
# Install dependencies, build project and download necessary browsers.
# Add project dependency
dotnet add package Microsoft.Playwright
# Build the project
dotnet build
playwright install
# Install required browsers
bin\Debug\netX\playwright.ps1 install
```
Create a `Program.cs` that will navigate to `https://playwright.dev/dotnet` and take a screenshot in Chromium.
@ -77,9 +71,12 @@ cd PlaywrightTests
Install dependencies, build project and download necessary browsers. This is only done once per project.
```bash
# Add project dependency
dotnet add package Microsoft.Playwright.NUnit
# Build the project
dotnet build
playwright install
# Install required browsers
bin\Debug\netX\playwright.ps1 install
```
Edit UnitTest1.cs file.
@ -119,7 +116,7 @@ dotnet test -- NUnit.NumberOfTestWorkers=5
[Command line tools](./cli.md) can be used to record user interactions and generate C# code.
```bash
playwright codegen
bin\Debug\netX\playwright.ps1 codegen
```
## System requirements