Skip to main content
The evaluate_js parameter allows you to run JavaScript code in the page context before rendering occurs.

Overview

When rendering a webpage with dynamic content, you may need to manipulate the DOM, trigger actions, or wait for content to load. The evaluate_js parameter lets you execute custom JavaScript code during the rendering process.

Parameter details

object
Allows you to run JavaScript code in the page context before rendering occurs

Usage

Behavior

The JavaScript expression is evaluated in the page context before rendering begins. If the expression returns a Promise, the rendering process will wait for the Promise to resolve before proceeding.

Use cases

This parameter is particularly useful for:
  1. Loading dynamic content: Trigger actions that load additional content before capturing the page.
  2. DOM manipulation: Modify page elements, styles, or attributes before rendering.
  3. Waiting for conditions: Ensure specific elements or data are available before rendering.

Examples

Clicking a Button

Waiting for content to load

Modifying page content

Scrolling the page