Evaluate JS
Evaluate JS
Section titled “Evaluate JS”Type: page-evaluate · Package: Browser v1.0.0 · Output: object
Executes JavaScript code within the context of the page and returns the result. It is an advanced activity: it gives you direct access to the DOM and the page’s APIs for cases that the other activities do not cover — reading a calculated value, manipulating a difficult element, or invoking a function on the page itself.
How it works
Section titled “How it works”Run the script on the page. It can be an expression (document.title) or a function that receives an argument ((arg) => arg.value * 2), in which case the value of the arg parameter is passed to it. Returns whatever the script returns.
Required parameters
Section titled “Required parameters”| Parameter | Editor | Description |
|---|---|---|
script | multiline text | JavaScript expression or function body. Ex: document.title or (arg) => arg.value * 2. |
Optional parameters
Section titled “Optional parameters”| Parameter | Editor | Description |
|---|---|---|
page | session | The page session. Omit it inside a body; outside, pass = page. |
arg | expression | Argument passed to the script if the script is a function. |
Output
Section titled “Output”Returns a object with the value returned by the script (text, number, list, etc.).
Example
Section titled “Example”Page Evaluate script = "document.title" → output: titulo
Page Evaluate script = "() => Array.from(document.querySelectorAll('.precio')).map(e => e.innerText)" → output: preciosRelated activities
Section titled “Related activities”- Get Text / Get Attribute — simple and recommended options for reading data.
- Click — standard interaction without the need for JavaScript.