JavaScript Execution
RTILA X provides two ways to execute JavaScript.
execute_script (Browser-Side)
Section titled “execute_script (Browser-Side)”Runs JavaScript in the browser page context. The script has access to the DOM and page elements.
| Parameter | Description |
|---|---|
script |
JavaScript code to execute |
output_variable |
Variable to store the return value |
Example:
script: return document.title;output_variable: page_titleExample — Click an element:
script: document.querySelector('.submit-button').click();Example — Get all links:
script: return Array.from(document.querySelectorAll('a')).map(a => a.href);output_variable: all_linksrun_script (Server-Side)
Section titled “run_script (Server-Side)”Runs a Deno script on the server side. The script has full access to the file system, network, and RTILA APIs.
| Parameter | Description |
|---|---|
script |
Deno script code |
⚠️ Warning:
run_scriptruns with full system access. Use with caution.
Example:
script: | const data = await Deno.readTextFile("data.json"); const parsed = JSON.parse(data); return parsed;Variable Access in Scripts
Section titled “Variable Access in Scripts”In execute_script, you can access runtime variables via the variables object:
script: return variables.price * 1.2;Script Transformations
Section titled “Script Transformations”In dataset transformations, the script transformation receives the current value as value:
code: return value.toUpperCase().replace("USD", "").trim();