docs(dotnet): Playwright examples (#6558)

This commit is contained in:
Anže Vodovnik 2021-05-13 19:19:14 +02:00 committed by GitHub
parent 47645ec815
commit ea59fd8f83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,6 +65,24 @@ with sync_playwright() as playwright:
run(playwright)
```
```csharp
using Microsoft.Playwright;
using System.Threading.Tasks;
class PlaywrightExample
{
public static async Task Main()
{
using var playwright = await Playwright.CreateAsync();
await using var browser = await playwright.Chromium.LaunchAsync();
var page = await browser.NewPageAsync();
await page.GoToAsync("https://www.microsoft.com");
// other actions...
}
}
```
## property: Playwright.chromium
- type: <[BrowserType]>
@ -135,6 +153,25 @@ with sync_playwright() as playwright:
Returns a dictionary of devices to be used with [`method: Browser.newContext`] or [`method: Browser.newPage`].
```csharp
using Microsoft.Playwright;
using System.Threading.Tasks;
class PlaywrightExample
{
public static async Task Main()
{
using var playwright = await Playwright.CreateAsync();
await using var browser = await playwright.Webkit.LaunchAsync();
await using var context = await browser.NewContextAsync(Playwright.Devices["iPhone 6"]);
var page = await context.NewPageAsync();
await page.GoToAsync("https://www.theverge.com");
// other actions...
}
}
```
## property: Playwright.errors
* langs: js
- type: <[Object]>