Skip to content

screenshot()

Captures a screenshot of the page. Appends timeStamp to filename if no filepath given.

await screenshot()
await screenshot({path : 'screenshot.png'})
await screenshot({fullPage:true})
await screenshot(text('Images', toRightOf('gmail')))
NameTypeDescription
selectorselector | string
optionsObjectDefault: {}.
options.fullpagebooleantoggles full page screenshot Default: false.
options.pathstringpath of the output file Default: 'Screenshot-${Date.now()}.png'.
options.encodingstringencoding for the image Default: 'base64'.
TypeDescription
Promise<Buffer>Promise which resolves to buffer with captured screenshot if {encoding:'base64'} given, otherwise it resolves to undefined.