QTP - Ordinal Identifiers


What are Ordinal Identifiers ?

Sometimes there are series of objects with same class name and properties. Lets us say in a window there are series of checkboxes with the same set of properties. If we want to act on those objects we need to uniquely identify them so that QTP will be able to act on it.

An Ordinal Identifier assigns a numerical value to the test objects which indicates its location or order relative to its group. The Ordered value enables QTP to recognize it uniquely when the inbuilt properties are NOT sufficient to do so.

There are 3 Ordinal Identifiers in QTP that can be used in different context:

  • Index
  • Location
  • Creation Time


An object appearing first in the page/Window will have a smaller Index value when compared to another object that comes later in the same page/Window.

Understanding - Index

The Value of index for the group of text boxes will be as follows:

Object Name Index Value
TextBox 1 0
TextBox 4 1
TextBox 2 2
TextBox 5 3
TextBox 3 4
TextBox 6 5


The Location property works vertically from top to bottom and from left to right. Hence for the same case, the value of location for the group of text boxes will be as follows:

Object Name Index Value
TextBox 1 0
TextBox 2 1
TextBox 3 2
TextBox 4 3
TextBox 5 4
TextBox 6 5

Creation Time:

The Creation Time property holds good only for web based application. When we open 2 browser sessions of the same website, QTP will not be able to recognize the window as both the window will have the same set of properties. Hence we can use creation time with which QTP will be able to act on the window.

'Will have CreationTime value = 0
SystemUtil.Run "iexplore.exe", "http://www.google.com"     

'Will have CreationTime value = 1	
SystemUtil.Run "iexplore.exe", "http://www.yahoo.com"      

'Will have CreationTime value = 2   
SystemUtil.Run "iexplore.exe", "http://www.microsoft.com"  

'Will have CreationTime value = 3  
SystemUtil.Run "iexplore.exe", "http://www.facebook.com"   

Hence to work on a specific browser, we need to explicitly mention the Creation time in OR or we can use description of objects which we will see in detail in descriptive programming section.

'Sync's www.google.com
Browser("creationtime:=" ).Sync     	          

'Gets the RO text property of www.yahoo.com 

'Highlights microsoft.com