screenshot()
Captures a screenshot of the page. Appends timeStamp to filename if no filepath given.
Examples
Section titled “Examples”await screenshot()await screenshot({path : 'screenshot.png'})await screenshot({fullPage:true})await screenshot(text('Images', toRightOf('gmail')))Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
selector | selector | string | |
options | Object | Default: {}. |
options.fullpage | boolean | toggles full page screenshot Default: false. |
options.path | string | path of the output file Default: 'Screenshot-${Date.now()}.png'. |
options.encoding | string | encoding for the image Default: 'base64'. |
Returns
Section titled “Returns”| Type | Description |
|---|---|
| Promise<Buffer> | Promise which resolves to buffer with captured screenshot if {encoding:'base64'} given, otherwise it resolves to undefined. |