Hide an element without the page collapsing around it
Removing a node changes the layout. Hiding it keeps the space — which is why a hidden capture still looks like the page a visitor sees.
hide_selectorserror_on_selector_not_foundstylescurl --fail-with-body "https://api.pagecapture.dev/v1/take" \
-H "X-Access-Key: $PAGECAPTURE_KEY" \
-H "Content-Type: application/json" \
--data '{"url":"https://example.com","format":"jpg","hide_selectors":"header"}' \
-o capture.jpgVerified 2026-08-13 by running the published code against a fixture.
Configure it in the playgroundWhat it does
- Applies `visibility: hidden !important` to every selector you pass, in one injected rule, before scripts and actions run.
- Skips a selector that matches nothing. The capture continues, because a missing element is usually a page variant rather than a failure.
- Composes with the built-in blockers: chat and consent selectors join the same hidden set when those flags are on.
What it does not do
- Does not reflow the page. The element keeps its box; only its pixels go.
- Does not reach inside a closed shadow root by default. `include_shadow_dom` is what makes selectors cross that boundary.
- Does not remove anything from the DOM, so a script that measures the element still finds it.
Every limit on this page is the one the API enforces
These rows are read from the same parameter table that validates your request. Nothing here is transcribed, so a number cannot drift from the behaviour it describes.
| Parameter | Type | Default | Range | Endpoints | Cache key |
|---|---|---|---|---|---|
hide_selectorsSelectors to hide before capturing. | string[] | — | — | /v1/take, /v1/animate | In |
error_on_selector_not_foundFail when the capture, hide or wait selector does not match, instead of skipping it. | boolean | false | — | /v1/take, /v1/animate | In |
stylesCSS injected into the page. | string[] | — | — | /v1/take, /v1/animate | In |
How it behaves next to the rest of the request
error_on_selector_not_foundFail when the capture, hide or wait selector does not match, instead of skipping it.
Default `false`, and the asymmetry is deliberate: a capture selector that matches nothing is skipped, while a `click` or `hover` selector that matches nothing fails. Set it to `true` when a missing element means the page is wrong, not just different.
include_shadow_domTraverse open shadow roots when resolving selectors and serializing HTML.
Widgets shipped as web components live in shadow roots. Without this flag the selector never matches, and — with the default failure policy — you get a clean capture that quietly still contains the widget.
stylesCSS injected into the page.
If you need the space to collapse after all, inject `display: none` through `styles` instead. Hiding is the safe default; removal is the explicit choice.
Errors this option can produce
None of them is billable. No error code in the catalog is.
Related capabilities
All capabilities100 successful captures a month, every feature unlocked, no card.
Get an API keyPageCapture Engineering · reviewed by PageCapture API maintainers · Verified 2026-08-13 by running the published code against a fixture.