Run Script
AI-generatedSummary
Navigate to a specified URL, optionally wait for certain page states or selectors, perform configured user-like actions, then execute custom JavaScript code in the page context and return its result.
Inputs
- URL (required) — The URL of the web page to navigate to.
- Wait Until — Specifies the event that determines when the navigation is considered successful; options include DOM content loaded, load event, network idle, or commit.
- Wait for Selector — Optional CSS selector to wait for after navigation to ensure dynamic content is loaded.
- Actions Before Extract — A list of user-like actions to be performed on the page after navigation but before executing the script, such as clicking elements, filling or typing inputs, waiting for selectors, scrolling to the bottom, or pausing for a delay.
- JavaScript Code (required) — Custom JavaScript code to evaluate within the page context; its return value will be included in the output.
Output shape
a list of JSON objects, one per input item, each containing the navigated URL and the result of the evaluated JavaScript code in the page context
If the JavaScript evaluation returns a primitive value, it is wrapped inside an object with a 'value' property; objects are returned as-is. Errors during execution can be handled by enabling 'Continue On Fail' to output error messages instead of failing the node.
Examples
Example 1: Evaluate a script that counts the number of items on a page
Set the URL, use default waitUntil and timeout, leave 'Wait for Selector' empty, no pre-actions, and input JavaScript code like 'document.querySelectorAll(".item").length'. The output will include the URL and the count result.