Version: 1.7.0


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(); // Or 'firefox' or 'webkit'.
const page = await browser.newPage();
await page.goto('');
// other actions...
await browser.close();

By default, the playwright NPM package automatically downloads browser executables during installation. The playwright-core NPM package can be used to skip automatic downloads.


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


Returns a list of devices to be used with browser.newContext([options]) or browser.newPage([options]). Actual list of devices can be found in src/server/deviceDescriptors.ts.

const { webkit, devices } = require('playwright');
const iPhone = devices['iPhone 6'];
(async () => {
const browser = await webkit.launch();
const context = await browser.newContext({
const page = await context.newPage();
await page.goto('');
// other actions...
await browser.close();


Playwright methods might throw errors if they are unable to fulfill a request. For example, page.waitForSelector(selector[, options]) 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.waitForSelector('.foo');
} catch (e) {
if (e instanceof playwright.errors.TimeoutError) {
// Do something if this is a timeout.


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


Selectors can be used to install custom selector engines. See Working with selectors) for more information.


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