Skip to content

Commit

Permalink
docs(dotnet): Playwright examples (#6558)
Browse files Browse the repository at this point in the history
  • Loading branch information
avodovnik committed May 13, 2021
1 parent 47645ec commit ea59fd8
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions docs/src/api/class-playwright.md
Expand Up @@ -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]>

Expand Down Expand Up @@ -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]>
Expand Down

0 comments on commit ea59fd8

Please sign in to comment.