RIATest 2 Documentation Copyright © RIATest.com

Locator Object

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.

Methods

MethodDescription

Locator

Locator(propertyList)
Locate a Flex object with matching properties. propertyList is an Object; The first Flex object which has all properties matching the specified object property values will be located. Property values can be primitive types (String, Number, etc), RegExp to match using regular expressions or Arrays for complex properties.

addPart

addPart(locator)
Adds a locator to current object forming a multipart locator.

toString

toString()
Returns string representation of this object.