RIATest 2 Documentation Copyright © RIATest.com

Data types

Every piece of data in RIAScript belongs to one of the following types: Number, String, Array, Object, Locator.

Number can be integer or fractional with decimal point. Standard arithmetic and comparison operators are supported for numbers, e.g. 5+2, 10*7/(2+3).

String is written using double or single quotes, e.g. "Hello World", or 'This is text'.

Array can be created and accessed using square brackets:

var arr = [1,3,5]; // creates an array consisting three elements
var x = arr[0]; // gets first element from array and assigns to x

Object can store multiple named values (also called properties):

var obj = {x:10, y: 20};
trace(obj.x); // prints 10 in the message log

Locators

Locator is used for referencing application components:

var myButton = FlexButton("Login");
myButton=>click(); // performs 'click' on the button<
trace(myButton=>label); // prints 'Login' in message log

The above expression creates a locator for Button that has text 'Login' and performs a 'click' action on the button. Notice how => execution operator is used for calling actions and getting properties values.
Locators can also reference multiple components in the hierarchy of your application componenets. This may be required to uniquely identify a component. For example suppose you have multiple panels in your application and buttons named 'Close', one in each visible panel. You can use the following locator to click on the desired button:

var aButton = FlexPanel("Authors")->FlexButton("Close");
aButton=>click();

This code snippet will locate the 'Close' button in the 'Authors' panel and will click it. Parts in a multipart locator are separated by locator compose -> operator. Note that if necessary RIATest will correctly generate multipart locators during recording.