AAIS Script Language
AAI Script (AAIS) is a small scripting language built on top of FindNode. It has simple syntax with a dozen commands, designed for quick tests rather than complex scripting.
Key Features
- Object-based (not coordinate-based)
- Works with mixed device environments
- Multi-threaded execution across 1-50 devices
- File extension:
.tst
Commands Reference
click / longClick
Click or long-click on screen elements. If the element is not found, the script stops.
click OK
click "Sign In"
longClick "Delete Item"open / restart
Launch or restart apps by package name or app name:
open com.example.myapp
restart "Chrome"wait
Wait until a match is found or timeout expires (default: 5000ms):
wait "Loading complete"
wait "Ready" 10000text
Enter text into input fields:
text "Hello World" // first editable field
text 0 "Username" // by position (0-indexed)
text "Enter name" "John" // by hint stringpress
Press keycodes or key names:
press Enter
press Back
press Home
press Power
press Tabfind
Scroll the screen until a match is found:
find "Settings" // scroll down (default)
find "Settings" up // scroll up
find "Settings" fromTop // scroll from top
find "Settings" fromBottom // scroll from bottomexec
Load external files:
exec "login_test.tst" // load AAIS file
exec "helper.js" // load JavaScript fileOther Commands
| Command | Description | Example |
|---|---|---|
print | Output to log | print "Test passed" |
delay | Pause (ms) | delay 2000 |
check | Toggle checkbox | check "Remember me" true |
progress | Set slider | progress "Volume" 50 0 100 |
get | Retrieve info | get id "OK", get text "button1" |
sendAai | Send FindNode command | sendAai {"query":"T:OK","action":"click"} |
JavaScript Integration
AAIS scripts can embed JavaScript blocks with curly braces:
click "Start"
{
var count = getOutput().count;
if (count > 5) {
saveVar("status", "many");
}
}
print "Done"Data flows between AAIS and JavaScript via getOutput() and template literals ${expression}.
Built-in Functions
| Function | Description |
|---|---|
getDevice() | Current device object |
getDevices() | All selected devices array |
saveVar(name, value) | Store device-scoped variable |
loadVar(name) | Retrieve device-scoped variable |
saveGlobalVar(name, value) | Store global variable |
loadGlobalVar(name) | Retrieve global variable |
doOnce() | Returns true only on first execution |
getOutput() | Access FindNode command results |
getArg() | Retrieve command-line arguments |
log(message) | Append to Runner log file |
throw(message) | Stop execution with error |
Creating Scripts
- Create a
.tstfile using any text editor - Or use the Record and Replay tool (select Object mode)
Running Scripts
Use the Runner interface in MDCC or WDM:
Write .tst file
Open Runner
Select devices
Run script
View logs & results
rjckb2
Example: Tesla VIN Retrieval
open Tesla
find "VIN:"
{
var output = getOutput();
var vin = output.retval;
saveGlobalVar("vin", vin);
log("VIN: " + vin);
}
print "VIN saved"Example: Conditional App Launch
{
var args = getArg();
var appIndex = args[0] || 0;
}
open ${appIndex == 0 ? "Chrome" : "Firefox"}
wait "Ready" 5000
click "Search"