Skip to content
Help Center Screenshots JavaScript Injection

Screenshots

JavaScript Injection

Inject external script URLs or inline JavaScript into the page before capture.

Script URL injection

Provide one or more external JavaScript URLs to load into the page before the screenshot is taken. Multiple URLs can be separated by commas or newlines:

{
  "url": "https://example.com",
  "script": "https://cdn.example.com/highlight.js"
}

The script is executed in the page's context after the DOM is ready.

Inline script

Execute a block of JavaScript directly in the page before capture:

{
  "url": "https://example.com",
  "script_inline": "document.querySelector('.banner').remove();"
}

Use cases

  • Remove dynamic elements (e.g. chat widgets, overlays) before capture.
  • Force a specific UI state (e.g. expand an accordion, set a value).
  • Load a custom polyfill or helper library.
  • Inject CSS-in-JS styles for custom rendering.

Security note

Scripts run in the browser context and have full DOM access. Use this feature only with scripts you trust.

Last updated March 27, 2026