Selectors and clip

Capture one element, or an exact rectangle.

By selector

{ "url": "https://example.com", "selector": "#pricing-table", "format": "png" }

The selector is always CSS. selector_algorithm picks how the element becomes an image, not how the selector is read:

  • default — the browser element API, which respects transforms and overflow. Default.
  • clip — convert the element's bounding box into a viewport rectangle. Use it when a shadow, sticky position or pseudo-element spills outside the box and you want what you see.

include_shadow_dom=true traverses open shadow roots.

If nothing matches, the capture falls back to a normal viewport capture. Set error_on_selector_not_found=true to fail with selector_not_found instead — the default is false for capture selectors, and true for click and hover, which have their own error_on_click_selector_not_found and error_on_hover_selector_not_found.

By rectangle

clip_x, clip_y, clip_width and clip_height capture an exact region in CSS pixels. All four must be sent together — three of them is a mistake, not a shorthand.

selector, the clip rectangle and full_page are mutually exclusive. Combining them has no single obvious meaning, so the API rejects the combination instead of picking one for you.