← Back to Page domain

Page.captureScreenshot

Capture page screenshot.

Domain: Page stable

Parameters

NameTypeDescription
format (optional)stringImage compression format (defaults to png).
quality (optional)integerCompression quality from range [0..100] (jpeg only).
clip (optional)ViewportCapture the screenshot of a given region only.
fromSurface (optional)booleanCapture the screenshot from the surface, rather than the view. Defaults to true.
captureBeyondViewport (optional)booleanCapture the screenshot beyond the viewport. Defaults to false.
optimizeForSpeed (optional)booleanOptimize image encoding for speed, not for resulting size (defaults to false)

Returns

NameTypeDescription
datastringBase64-encoded image data. (Encoded as a base64 string when passed over JSON)

Example Request

{
  "id": 1,
  "method": "Page.captureScreenshot"
}

Example Response

{
  "id": 1,
  "result": {
    "data": "base64-encoded-data..."
  }
}

Usage in Node.js

const result = await send('Page.captureScreenshot');
console.log(result);
// {"data": "base64-encoded-data..."}