Object Identification during Replay

September 7, 2009 at 6:28 am 2 comments

In flex/air automation, the scripts recorded captures the object identification properties during recording and passes the same details to the framework during replay. 

An object is identified in the application starting from the application through its children till the current object is reached.

Assume there is a Panel which has a button and when the user click on the button the script may look as follows.


During replay, the automation framework identifies the application and verifies whether it is the “YYY” application.  Once the current application object is matched, it gets is all automation children and tries to match the Panel (“ZZZ”) under the same.

Automation uses the following propertis to identify an object.

  • Automation Class Name
  • ClassName
  • Automation Name
  •  Id
  •  Automation Index

However user can configure what needs to be used to identify an object, even though the above 5 is expected to be maintained. User can add additional properties for identification of an object.  This can be mentioned in the env XML file details for that component.  E.g Button uses the label as the additional identification property.

This is handled by the following section in TEAFlex.xml for the component button.

<Property Name=”label” ForDefaultVerification=”true” ForDescription=”true” ForVerification=”true”>
        <Type VariantType=”String”/>
        <Description>Text to appear on the Button.</Description>

So for the above mentioned list of properties , in the xml file, it can be observed that, the for Description is marked true.

The meaning and the significance of the properties are mentioned below.

AutomationName : This is some property user can mention for each component to make it uniquely identifiable in the container. If the user has not mentioned the same, then for some components, this is assumed from some properties of the component. e.g for button label will be considered as the automation name. You can see this value in the script along with the object.

ClassName: This the fully qualified name of the component. e.g mx.controls.List

AutomationClassName : This is the name of the class mentioned in the xml file for the automation class corresponding to the object qualified class.

i.e  for an entry in the xml file as follows

<ClassInfo Name=”FlexList”GenericTypeID=”list” Extends=”FlexListBase” SupportsTabularData=”true”>
    <IconInfo IconFile=”TEAPluginQTP.dll” IconIndex=”217″/>
    <Implementation Class=”mx.controls::List” />
    <Implementation Class=”mx.controls::HorizontalList”/>
    <Implementation  Class=”mx.controls::TileList”/>

So for an object of a List, or HorizontalList or Tile List , FlexList will be the automationClassName where as mx.controls.List will be the class name.

Id- this is the ‘id’ property of the object defined by the user.

So all these properties mentioned above are used to identify the object.  However at times due to non availability of proper values of the above in the application, an object wont be uniquely identifiable in a container. e.g if there are two text Inputs, no id’s defined, is used in  a same container. Both the objects will have identical values for the above properties.  So in those scenario automationIndex is used. AutomationIndex finds the position of the object in its container.

When the object details is given , automation framework does not stop with the first object identified. It analyses its children and gets all the matching children and finds the best fit one. If there are multiple object which gets the same matching score, an error message is passed to the tool from the framework.  Tool is supposed to give the message and gracefully exit the script execution or decide what next to do.

I have not worked much with versions of QTP lesser than 9.2  Versions 9.2 and above handles the above mentioned situation by giving appropriate messages to the user. In this scenario you may get an error message from the tool in the following format 

If  no matching object found –  “Unable to resolve child for part ‘part.automationName‘:’part.className‘ in parent ‘currentParent.automationName‘”

If more than one matching object found – ‘count’ matches for critera {‘curent part description”}.

You may need to analyse the message and see why in the application current object is not uniquely identifiable.


For each matching property, the point is 1, if AutomationClassName does not match thes total score is -1, if all requried proerties match, the score is INT.MaxValue. Properties matched are properties as mentioned above which will be used for identification.

In flex4, to improve the performace, the scoring logic is changed as follows. If AutomationClassName if needed, is checked first and if does not match the remaining proerties will not be compared. If all other properties match only automationIndex is matched. automationIndex calculation is a very expensive calcualtion if the contianer has many children. So it indirectly means, automationClassName has the highest value and automationIndex the lowest.


Entry filed under: Flex Automation, Flex Automation.

Custom component Automation – Introduction Random walk ,Flex Automation – custom component, replay error

2 Comments Add your own

  • 1. Veronica Curtis  |  January 21, 2010 at 3:31 pm

    What causes the index to change? I have had to modify my scripts 3 times so far during this release after a build because the Automation index changes. This is very time consuming. Is there anyway around that? I am using QTP 9.5, with IE7

    • 2. raniskumar  |  April 13, 2010 at 1:13 pm

      Automation index is used only if other properties are not matched. ie if you have two identica objects under the same container.
      user automationName, id etc so that the automation_index is not used to resolve the object.

      And index changing indicates that your object order is not fixed. If you are ensuring that your provide other identication details like autoamtion name, id etc for the index changing object, try removing the ‘automationIndex’ property from the XML file and record.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


September 2009
« Aug   Oct »

Most Recent Posts

%d bloggers like this: