Identifying Flash and Flex Objects

Applies to TestLeft 15.40, last modified on March 17, 2022
Flash Player has reached end of life on December 31, 2020. Support for Flash and Flex applications is now deprecated in TestComplete and will be removed in a future release.
Search Patterns

TestLeft allows you to test Flash and Flex applications. To search for objects in Flash and Flex applications, you use search patterns of the FlashPattern type:

.NET: The pattern belongs to the SmartBear.TestLeft.TestObjects.Flash namespace.

Java: The pattern belongs to the com.smartbear.testleft.testobjects package.

This pattern uses the properties listed in the table below. You can see the values of these properties in the TestLeft UI Spy.

Property Type Description
Enabled Boolean Specifies whether the object is enabled or disabled. Disabled objects are usually shown grayed out.
ObjectGroupIndex Integer The object’s index among sibling objects that either have the same ObjectType, ObjectIdentifier and ObjectLabel, or have neither of these values.
ObjectIdentifier String or
Integer

In instrumented applications, the object ID is usually the object’s name or id (in that order of preference) that is specified by the developers in the application code.

In non-instrumented applications, the object ID is derived from the object’s accessibility name by replacing spaces and other illegal characters with underscores. If two or more objects have the same non-empty ID, they have indexes appended to their ID, for example, color, color_2, color_3, and so on.

If the object does not have a name, id or accessibility name, ObjectIdentifier is the object’s index (0-based) among sibling objects of the same type.

ObjectLabel String Used for instrumented applications only. This is the value of one of the following properties of the object (in order of preference):
  • id
  • label
  • title
  • data
  • data.label
  • text (for labels only)
ObjectType String

In instrumented applications, this is the class name of the object. For example, Button in case of mx.controls::Button objects. This is the last part of the value returned by flash.utils.getQualifiedClassName().

In non-instrumented applications, the object type reflects its accessibility role, and, usually, matches the role without the ROLE_SYSTEM_ prefix. For example, the ListItem type corresponds to ROLE_SYSTEM_LISTITEM.

Visible Boolean Specifies whether the object is visible in the application. Objects that are out of screen bounds or overlapped by other objects are still considered visible.

You can use any combination of these properties in your search patterns.

Example

C#

IButton buttonYes = tourDeFlex.Find<IControl>(new FlashPattern() {
   ObjectType = "Alert",
   ObjectLabel ="Save Changes"
}).Find<IButton>(new FlashPattern() {
   ObjectType = "Button",
   ObjectIdentifier = "YES"
}, 2);

Visual Basic .NET

Dim button As IButton = tourDeFlex.Find(Of IControl)(New FlashPattern() With {
   .ObjectType = "Alert",
   .ObjectLabel = "Save Changes"
}).Find(Of IButton)(New FlashPattern() With {
   .ObjectType = "Button",
   .ObjectIdentifier = "YES"
}, 2)

Java

Button button = tourDeFlex.find(Control.class, new FlashPattern() {{
   ObjectType = "Alert";
   ObjectLabel = "Save Changes";
}}).find(Button.class, new FlashPattern() {{
   ObjectType = "Button";
   ObjectIdentifier = "YES";
}}, 2);

Custom Properties

You can also specify custom properties by using the .add("propertyname", value) method of the pattern object. See Using Custom Properties in Search Patterns.

See Also

Understanding Object Identification
Preparing Flash and Flex Applications for Testing
Preparing Web Browsers for Testing

Highlight search results