Documentation or examples showing how JS integrates with Ui.Vision

Hello everyone,

I’m new to Ui.Vision and I would like to start learning JavaScript so I can create more advanced and flexible macros. I have no previous programming experience, so I’m looking for beginner‑friendly documentation that explains both JavaScript basics and how JS is used inside Ui.Vision.

So far, I’ve seen that Ui.Vision supports JavaScript through:

  • executeScript

  • executeScript_Sandbox

  • uiVisionGetVar() and uiVisionSetVar()

But as a beginner, it’s hard for me to understand where to start, what JavaScript concepts I need to learn first, and which JS-related features in Ui.Vision are fully working in the current version (v10) versus which ones have limitations or issues.

Thank you in advance!

Hello and welcome!

First, a correction, because it will save you time: uiVisionGetVar() and uiVisionSetVar() do not exist in Ui.Vision. If an AI chatbot or an old post suggested them, ignore that. Variables are read and written as described below.

Two ways to use JavaScript in Ui.Vision v10

1. Inside a classic macro (small snippets)

  • executeScript_Sandbox runs JavaScript inside the extension. Use it for calculations and string work on variables.
  • executeScript runs JavaScript inside the web page, so it can read or change the page (DOM).
  • In both, you read a macro variable by writing ${myVar} in the code.
  • You get a result back with return. It is stored in the variable named in the Value field.
Command: executeScript_Sandbox
Target:  return Number(${price}) * 1.19;
Value:   total

Docs: executeScript, execute script, Arrays - Selenium IDE Commands Tutorial

The DemoExecuteScript macro that ships with the extension shows this in action.

2. JS macros (the whole macro is a script)

This is new in v10. Instead of a command table you write a script with the uiv. API (uiv.goto, uiv.browser.click, uiv.browser.type, uiv.getVar / uiv.setVar …). You get real if, loops and functions.

The extension installs many demo scripts (DemoAutofill, DemoIfElse, DemoCsvReadWithWhile, DemoExtract …). Open them, run them, change one line and run again. That is the fastest way to learn.

Docs: The uiv.* API: JS Script Macros Overview | Ui.Vision RPA (overview of the uiv. API) and Selenium Commands vs the Modern uiv.* API | Ui.Vision RPA (classic commands next to their uiv. equivalent).

Which JavaScript to learn first (in this order)

  1. Variables, strings and numbers (let, +, .trim(), .replace(), .split())
  2. if / else and comparisons
  3. Arrays and loops (for, while)
  4. Functions
  5. Later: regular expressions, JSON.parse, dates

You do not need frameworks, HTML/CSS, async/promises or Node.js for Ui.Vision macros. A good free beginner course is https://javascript.info (part 1 only) or the MDN “JavaScript first steps” guide.

What works and what is limited

  • executeScript_Sandbox uses a built-in safe interpreter. Basic JavaScript works fully. Some very modern syntax may not, so keep the code simple (var / function, no arrow-function tricks) and you will never hit a limit. It has no access to the web page. That is by design.
  • executeScript has the full JavaScript of the browser, but only inside the page. Some websites block injected scripts with a strict content security policy. If a script does nothing on one site, that is usually the reason.
  • Neither can press real keys or click outside the page. For that there are the XClick / XType commands (or uiv.desktop.* in JS macros) together with the desktop app.

Tip: the built-in AI chat in the side panel can write and explain macros for you. Asking it “explain this script line by line” is a good way to learn.

If you get stuck on a specific macro, post it here and we will help.