Skip to main content

PlaywrightScreenshotHandler

Captures page screenshots through Playwright, as a whole viewport or a single element.

Notes

Set as the screenshotHandler of a PlaywrightFetcher, this takes a screenshot of every page the browser renders. With a cssSelector, Playwright captures just that element itself — no full-page capture and crop, which is how the WebDriver handler has to do it.

Where the image goes, in what format, and under what directory layout are all in ScreenshotHandlerConfig, shared by both handlers. Storing to DIRECTORY and indexing the path is almost always preferable to putting an encoded image on the document.

Examples

fetchers:
- class: PlaywrightFetcher
browser: CHROMIUM
screenshotHandler:
targets:
- DIRECTORY
targetDir: ./screenshots
cssSelector: "article"

Usage

Full configuration skeleton, with every option and its default
configuration:
cssSelector: string
imageFormat: string
targetDir: string
targetDirField: string
targetDirStructure: URL2PATH
targetMetaField: string
targets:
- METADATA

Properties

PropertyTypeRequiredDefault
configurationScreenshotHandlerConfigNo-

Property Details

configuration

Storage and capture options — targets, directory, format, CSS selector. See ScreenshotHandlerConfig.