Skip to content

Screenshot Definition Reference

Back to Configuration overview.

PropertyTypeDefaultDescription
idstringautoUnique identifier (auto-generated if omitted)
namestring-Display name, also used to derive the output filename
urlstring-Full URL of the page to capture
selectorstring-Element selector for capture (omit for full-page). Supports Playwright selector formats: CSS (.class, #id), shadow DOM (host >> child), XPath (xpath=...), text (text=...), role (role=button[name="OK"]), and chained selectors.
paddingobject-Expand capture area beyond element bounds
padding.topnumber0Top padding in pixels
padding.rightnumber0Right padding in pixels
padding.bottomnumber0Bottom padding in pixels
padding.leftnumber0Left padding in pixels
scrollobject-Saved scroll position (not used during capture - scrollIntoView is used instead)
scroll.xnumber0Horizontal scroll offset in pixels
scroll.ynumber0Vertical scroll offset in pixels
paddingFill"inherit" | "solid" | "transparent"-Background fill for padding area: "inherit" (default) shows page content, "solid" fills with detected background color
paddingColorstring-Custom color for padding fill when set to "solid" (hex, defaults to auto-detected background)
elementFill"original" | "solid" | "transparent"-Background fill for element area: "original" (default) keeps actual background, "solid" replaces with detected color
elementColorstring-Custom color for element fill when set to "solid" (hex, defaults to auto-detected background)
viewportsstring[]-Viewport variants to generate — preset names ("desktop", "tablet", "mobile") or custom "WIDTHxHEIGHT"
textOverridesRecord-Replace text content before capture. Keys are CSS selectors, values are replacement text
annotationsobject[]-Visual annotations drawn over the screenshot (arrows, rectangles, ellipses)
annotations[].idstringautoUnique identifier (auto-generated if omitted)
annotations[].typestring-Annotation type: arrow, rect, or ellipse
annotations[].pointsnumber[]-Geometry points - meaning depends on type
annotations[].styleRecord-CSS/SVG style properties (stroke, stroke-width, fill, opacity, etc.)
borderWidthnumber-Border width around capture area in pixels (default 0)
borderColorstring-Border color (hex, default "#000000")
borderRadiusnumber-Corner radius in pixels — rounds the screenshot corners with transparency (PNG only)
actionsany[]-Ordered list of actions to execute before capturing. Actions run sequentially.

Example

json
{
  "id": "abc12345",
  "name": "My Screenshot",
  "url": "/dashboard",
  "selector": ".my-element",
  "padding": {},
  "scroll": {},
  "paddingFill": "inherit",
  "paddingColor": "value",
  "elementFill": "original",
  "elementColor": "value",
  "viewports": [],
  "textOverrides": {},
  "annotations": [],
  "borderWidth": 0,
  "borderColor": "value",
  "borderRadius": 0,
  "actions": []
}

Selector Formats

Heroshot uses Playwright's locator API under the hood, giving you access to powerful selector options beyond basic CSS.

FormatSyntaxExampleUse Case
CSS.class, #id".submit-button"Default, most common
Shadow DOMhost >> child"my-component >> .inner"Web components
XPathxpath=..."xpath=//button[@data-testid='submit']"Complex DOM traversal
Texttext=..."text=Submit"Select by visible text
Rolerole=..."role=button[name='OK']"ARIA-based selection
Chaineda >> b".modal >> role=button[name='Close']"Combine selectors

Shadow DOM

Use >> to pierce shadow DOM boundaries:

json
"selector": "my-custom-element >> .inner-content"

For deeply nested shadow DOM:

json
"selector": "outer-host >> inner-host >> .target"

Legacy Syntax

The >>> syntax still works and is auto-converted to >>.

XPath

For complex DOM traversal where CSS selectors fall short:

json
"selector": "xpath=//div[@class='container']//button[contains(text(), 'Save')]"

Text Selectors

Select elements by their visible text content:

json
"selector": "text=Sign In"

Role Selectors

Select by ARIA role for accessibility-focused selection:

json
"selector": "role=button[name='Submit']"

Playwright Documentation

For the complete selector syntax reference, see the Playwright Locators documentation.