Skip to main content
Execute JavaScript code in the browser context. This is useful for advanced interactions, reading page state, or performing actions that require direct DOM manipulation.

Usage

Request

string
required
The JavaScript code to execute in the browser. The code should be an expression or a function that returns a value.Example: document.title
dict
Optional dictionary of arguments to pass to the JavaScript function. When using args, your code must be a function that receives args as its parameter.Example: {"selector": ".product-price", "index": 0}

Response

Returns an object with the following attributes.
any
The result of the JavaScript evaluation. Complex objects are serialized to JSON.
float
The number of credits used for this action. 1 credit corresponds to $0.01.
float
The duration in seconds taken to execute the JavaScript.

Examples

Read page information:
Extract data from the DOM:
With arguments:
Scroll the page:
Interact with page elements:
Check page state before proceeding: