A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://playwright.dev/docs/api/class-playwright below:

Playwright Library | Playwright

Playwright Library

Playwright module provides a method to launch a browser instance. The following is a typical example of using Playwright to drive automation:

const { chromium, firefox, webkit } = require('playwright');

(async () => {
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('http://example.com');

await browser.close();
})();
Properties chromiumAdded before v1.9 playwright.chromium

This object can be used to launch or connect to Chromium, returning instances of Browser.

Usage

Type

devicesAdded before v1.9 playwright.devices

Returns a dictionary of devices to be used with browser.newContext() or browser.newPage().

const { webkit, devices } = require('playwright');
const iPhone = devices['iPhone 6'];

(async () => {
const browser = await webkit.launch();
const context = await browser.newContext({
...iPhone
});
const page = await context.newPage();
await page.goto('http://example.com');

await browser.close();
})();

Usage

Type

errorsAdded before v1.9 playwright.errors

Playwright methods might throw errors if they are unable to fulfill a request. For example, locator.waitFor() might fail if the selector doesn't match any nodes during the given timeframe.

For certain types of errors Playwright uses specific error classes. These classes are available via playwright.errors.

An example of handling a timeout error:

try {
await page.locator('.foo').waitFor();
} catch (e) {
if (e instanceof playwright.errors.TimeoutError) {

}
}

Usage

Type

firefoxAdded before v1.9 playwright.firefox

This object can be used to launch or connect to Firefox, returning instances of Browser.

Usage

Type

requestAdded in: v1.16 playwright.request

Exposes API that can be used for the Web API testing.

Usage

Type

selectorsAdded before v1.9 playwright.selectors

Selectors can be used to install custom selector engines. See extensibility for more information.

Usage

Type

webkitAdded before v1.9 playwright.webkit

This object can be used to launch or connect to WebKit, returning instances of Browser.

Usage

Type


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4