| [ Web Proxy ] |
| Viewing: https://playwright.dev/dotnet/docs/api/class-playwright | [Back] [Original] |
Playwright module provides a method to launch a browser instance. The following is a typical example of using Playwright to drive automation:
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...
}
}
Exposes API that can be used for the Web API testing.
Usage
Playwright.APIRequest
Type
This object can be used to launch or connect to Chromium, returning instances of Browser.
Usage
Playwright.Chromium
Type
Returns a dictionary of devices to be used with Browser.NewContextAsync() or Browser.NewPageAsync().
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...
}
}
Usage
Playwright.Devices
Type
This object can be used to launch or connect to Firefox, returning instances of Browser.
Usage
Playwright.Firefox
Type
Selectors can be used to install custom selector engines. See extensibility for more information.
Usage
Playwright.Selectors
Type
This object can be used to launch or connect to WebKit, returning instances of Browser.
Usage
Playwright.Webkit
Type
| Web Proxy Viewer | New URL | Original Page |