Principle:A9T9 RPA Script Authoring
| Knowledge Sources | |
|---|---|
| Domains | Browser_Automation, Desktop_Automation, Scripting_API |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
Mechanism for authoring browser and desktop automation macros as JavaScript programs using a domain-specific API (`uiv.*`) that abstracts element finding, input, and visual search.
Description
Script Authoring is the paradigm of writing automation macros as JavaScript programs rather than command tables. A JS script macro uses the `uiv.*` API — a domain-specific language injected into a sandboxed interpreter — to find elements (`uiv.$`, `uiv.getByRole`), interact with them (`uiv.page.click`, `uiv.page.fill`), search for images (`uiv.findImage`), find text via OCR (`uiv.ocr.findText`), and control flow with standard JavaScript constructs (if/while/for).
This addresses the limitations of command-table macros: command tables lack variables, control flow, and reusable functions. JS scripts provide full programming expressiveness while the `uiv.*` API abstracts the automation-specific operations (trusted input, visual search, desktop input) that are not available in a standard browser context.
The `uiv.run(cmd, target, value)` bridge allows JS scripts to invoke any classic command-table command, providing backward compatibility.
Usage
Use this principle when designing an RPA system that needs full programming expressiveness for complex automation workflows with conditional logic, loops, and reusable code.
Theoretical Basis
Script authoring is a domain-specific language (DSL) pattern: a host language (JavaScript) extended with domain primitives (`uiv.*`) that map to automation operations. The DSL is embedded in a sandboxed interpreter that bridges sandbox calls to the host environment.