GenerateBrowserScreenshot

Get a screenshot of a page

Syntax

LOADLIB "mod::system/lib/printer.whlib";

RECORD FUNCTION GenerateBrowserScreenshot(STRING url, RECORD options)

Parameters

STRING url

URL to take a screenshot of

RECORD options

Options

RECORD ARRAY cutouts

Cutouts. If set, returnvalue with look like [ screenshot := ..., cutouts := ... ]

STRING cutouts.selector
STRING cutouts.strategy

Element lookup strategy ('css selector', 'xpath')

BOOLEAN debug

Enable debug mode

INTEGER delay

How much milliseconds to wait after setting the url before taking a screenshot

BOOLEAN getlog

Return the browser log

STRING media

Media to use - 'screen' (default) or 'print'

INTEGER screenheight

Override the screen height (default: 1080)

INTEGER screenwidth

Set the screen width (default: 1920)

BOOLEAN withalpha

Take two screenshots, with different background colors on the body element. Calculates the alpha channel from the difference.

Return value

RECORD

Promise that resolve to a wrapped blob with the screenshot

cutouts

Informatation about the cutouts

BOOLEAN cutouts.found

Wether the element was found

FLOAT cutouts.height

When found, the heigth of the element

RECORD cutouts.image

Wrapped blob with image (if the coordinates are (partially) within the screenshot)

cutouts.selector

Selector

cutouts.strategy

Selected element lookup strategy

FLOAT cutouts.width

When found, the width of the element

FLOAT cutouts.x

When found, the x-position of the element

FLOAT cutouts.y

When found, the y-position of the element

log

Browser log (if requested via options.getlog)

STRING log.level

'INFO', 'WARNING'

STRING log.message
DATETIME log.timestamp
screenshot

Wrapped blob with the screenshot