Screenshot
Capture screenshots of the viewport, full page, or specific elements.
screenshot
Value: "viewport", "fullpage", or a CSS selector
Viewport Screenshot
Capture the visible area of the page.
{ "screenshot": "viewport" }
Full Page Screenshot
Capture the entire page by stitching multiple viewport segments. Automatically hides fixed/sticky elements to avoid duplication in the stitched image.
{ "screenshot": "fullpage" }
Element Screenshot
Capture a specific element. Supports large elements that extend beyond the viewport by auto-stitching multiple segments.
{ "screenshot": "#main-content" }
{ "screenshot": ".hero-section" }
Options
| Option | Type | Default | Description |
|---|---|---|---|
padding | number | 0 | Extra padding around element screenshots (pixels) |
{
"screenshot": "#chart",
"options": { "padding": 20 }
}
Return Value
{
"success": true,
"url": "https://files.browserworker.app/screenshots/workerId/taskId-timestamp.png"
}
The screenshot is automatically uploaded to cloud storage and a public URL is returned.
Notes
- Screenshots are DPI-aware — high-resolution displays produce proportionally larger images
- Full page stitching auto-hides
position: fixedandposition: stickyelements to prevent ghosting - Element screenshots scroll if the element is larger than the viewport
Example: Take Multiple Screenshots
{
"actions": [
{ "openNewTab": "https://example.com" },
{ "waitForEvent": "networkIdle" },
{ "screenshot": "viewport" },
{ "screenshot": "#hero" },
{ "screenshot": "fullpage" }
]
}
Example: Screenshot After Interaction
{
"actions": [
{ "openNewTab": "https://example.com/chart" },
{ "waitForElement": ".chart-loaded" },
{ "click": "#show-details" },
{ "wait": 1000 },
{ "screenshot": "#chart-container", "options": { "padding": 10 } }
]
}