Playwright
Playwright module provides a method to launch a browser instance. The following is a typical example of using Playwright to drive automation:
By default, the playwright
NPM package automatically downloads browser executables during installation. The playwright-core
NPM package can be used to skip automatic downloads.
- playwright.chromium
- playwright.devices
- playwright.errors
- playwright.firefox
- playwright.selectors
- playwright.webkit
#
playwright.chromium- returns: <BrowserType>
This object can be used to launch or connect to Chromium, returning instances of ChromiumBrowser.
#
playwright.devices- returns: <Object>
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/deviceDescriptors.ts.
#
playwright.errors- returns: <Object>
TimeoutError
<function> A class of TimeoutError.
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:
#
playwright.firefox- returns: <BrowserType>
This object can be used to launch or connect to Firefox, returning instances of FirefoxBrowser.
#
playwright.selectors- returns: <Selectors>
Selectors can be used to install custom selector engines. See Working with selectors) for more information.
#
playwright.webkit- returns: <BrowserType>
This object can be used to launch or connect to WebKit, returning instances of WebKitBrowser.