GenerateBrowserScreenshot (open)

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

STRING cutouts.selector

CSS Selector

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)

INTEGER timeout

Timeout (in milliseconds) for PDF generation. Defaults to 30 seconds

BOOLEAN withalpha

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

Return value

RECORD

Requested screenshot, logs and any requested cutouts

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

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