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.