Ordinal Identifier in QTP/UFT: Object Identification Example
โก Smart Summary
Ordinal Identifier in QTP/UFT is the tie-breaker UFT applies when mandatory and assistive properties still match more than one object, using Index, Location, or CreationTime values to pick a single unique object.

What is an Ordinal Identifier in QTP/UFT?
An Ordinal Identifier is a numeric property that UFT (formerly QTP) adds to an object description when the mandatory and assistive properties captured during a record session are not enough to identify the object uniquely. Instead of failing, the tool falls back on a counter that says, in effect, “take the third object of this class.”
By default, an ordinal identifier type exists for every test object class. A WebEdit is numbered differently from a WinButton, and a Browser is numbered differently again. You can view or modify the default ordinal identifier for a class in the Object Identification window.
As the screenshot above shows, the Ordinal identifier drop-down sits at the bottom of the Object Identification dialog, below the mandatory and assistive property lists. That position is not accidental: it mirrors the order in which UFT actually consults the three groups.
There are three types of ordinal identifiers in UFT:
- Index based
- Location based
- Creation Time
Why UFT Uses Ordinal Identifiers Only as a Last Resort
Object identification in UFT runs as a cascade. Mandatory properties are learned first. If they do not produce a single match, assistive properties are added one by one until the description is unique. Only when both groups are exhausted does UFT attach an ordinal identifier, and at runtime the Smart Identification mechanism is consulted before the ordinal value is trusted.
The reason for that ranking is stability. Mandatory and assistive properties describe what an object is: its name, its HTML tag, its type, its label. An ordinal identifier only describes where the object happened to sit at the moment of recording. Anything that changes the page changes the number:
- A developer inserts a hidden field above the one you automate.
- A promotional banner adds two extra links to the header.
- A responsive layout reflows the form from two columns into one.
- A pop-up browser opens earlier than it did during the recorded run.
None of these changes break a description built on a name or an ID, but each one silently shifts every index and location value on the page. This is why experienced engineers treat an ordinal identifier as a signal that the object description needs work, not as a finished solution. The same principle applies across automation testing frameworks generally, including locator strategy in Selenium.
๐ก Tip: Before accepting an ordinal identifier, open the object in the Object Spy and look for a stable custom attribute. Adding that attribute to the assistive property list for the class often removes the need for an ordinal on every future object of that type.
Types of Ordinal Identifiers in UFT/QTP
Index Based
- When an index based ordinal identifier is used, UFT assigns a value to the index property of the object during recording.
- The value is based on the order in which the object appears within the source code, not on the screen.
- The first occurrence has the value 0.
- Index property values are object-specific, so each test object class is counted separately.
- Therefore, if you use index:=3 to describe a WebEdit test object, UFT searches for the fourth WebEdit object on the page.
- Likewise, if you use index:=1 to describe a WebButton test object, UFT searches for the second WebButton object on the page.
Location Based
- When a location based ordinal identifier is used, UFT assigns a value to the location property of the object to identify it uniquely.
- The value is based on the order in which the object appears within the window, frame, or dialog box, in relation to other objects with identical properties.
- The first occurrence of the object is 0.
- Values are assigned in columns, from top to bottom and then left to right.
- Location is the default ordinal identifier for most Standard Windows test object classes, where visual layout is more stable than markup order.
Creation Time
- When the creation time ordinal identifier is used, UFT assigns a value to the creationtime property of a browser object.
- This identifier is available only for the Web environment and only for Browser test objects.
- The value indicates the order in which the browser was opened relative to other open browsers.
- The first browser opened during the run receives creationtime:=0, and succeeding browsers receive 1, 2, 3, and so on.
- If a browser is closed, the remaining browsers keep their original values rather than being renumbered.
Index vs Location vs CreationTime: Comparison Table
The three identifiers answer three different questions, and choosing the wrong one is a frequent cause of intermittent failures.
| Aspect | Index | Location | CreationTime |
|---|---|---|---|
| Property name | index | location | creationtime |
| Ordering basis | Order in the source code / object hierarchy | Screen position inside the window, frame, or dialog | Order in which browser instances opened |
| Counting rule | Sequential, per test object class | Columns, top to bottom then left to right | Sequential, per browser instance |
| First value | 0 | 0 | 0 |
| Applies to | Web and Windows classes | Mainly Standard Windows classes | Browser objects only |
| Breaks when | Markup order changes | Layout is repositioned or resized | Windows open in a different sequence |
| Best used for | Repeating grid or table controls | Legacy desktop forms with fixed layout | Multi-window web flows such as payment pop-ups |
How to Set the Ordinal Identifier in the Object Repository
The ordinal identifier is configured per test object class, and it is applied automatically to every object of that class that UFT learns afterwards. Existing objects already in the repository are not updated retroactively.
- Open UFT and select Tools > Object Identification.
- Choose the environment, for example Web or Standard Windows, from the Environment drop-down.
- Select the test object class you want to change, such as WebEdit or WinButton.
- In the Ordinal identifier section, select Index, Location, CreationTime, or None.
- Click OK and re-learn the object so the new ordinal value is captured.
- Open the Object Repository, select the object, and confirm the ordinal property now appears in the description list.
Selecting None disables the fallback for that class entirely. UFT will then raise an identification error rather than guess, which is often the behaviour you want in a suite where silent misidentification is more damaging than a clean failure. Recording your expectations in a well-written test case makes that trade-off explicit for the whole team.
โ ๏ธ Warning: Changing the ordinal identifier for a class is a machine-level setting, not a test-level one. If it is not exported and shared, scripts that pass on your machine can fail on a colleague’s machine or on the build agent.
How to Use Ordinal Identifiers in Descriptive Programming
In descriptive programming there is no Object Identification dialog. The ordinal is written directly into the description string, exactly like any other property name, and it is always zero based.
' Ordinals are zero based: index:=3 is the FOURTH WebEdit on the page Set objPage = Browser("Guru99 Bank").Page("Guru99 Bank") objPage.WebEdit("index:=3").Set "9999999999" Print "Filled WebEdit occurrence #" & (3 + 1) ' Location is counted top to bottom, then left to right objPage.WebButton("location:=1").Click Print "Clicked WebButton occurrence #" & (1 + 1) ' CreationTime works only on Browser objects Print "Switching to browser opened at position #" & (1 + 1) Browser("creationtime:=1").Sync
Output:
Filled WebEdit occurrence #4 Clicked WebButton occurrence #2 Switching to browser opened at position #2
A safer pattern is to combine real properties with ChildObjects so the ordinal is validated before it is used. The example below assumes a page containing five matching WebEdit objects and an index of 9.
Dim oDesc, oChildren, intIndex Set oDesc = Description.Create() oDesc("micclass").Value = "WebEdit" oDesc("html tag").Value = "INPUT" Set oChildren = objPage.ChildObjects(oDesc) intIndex = 9 If intIndex < oChildren.Count Then oChildren(intIndex).Set "Guru99" Else Print "Index " & intIndex & " is out of range; only " & oChildren.Count & " objects match" End If
Output:
Index 9 is out of range; only 5 objects match
This guard turns an unhelpful “Cannot identify the object” runtime error into a readable message, which matters when results are published to a defect tracker or to HP ALM integrated with UFT.
Common Mistakes When Using Ordinal Identifiers
Most ordinal-related defects trace back to a small set of recurring errors.
- Counting from 1. Every ordinal identifier starts at 0. Writing index:=1 for the first field is the single most common mistake and produces an off-by-one failure that looks like a timing issue.
- Confusing index with location. Index follows the source code; location follows the screen. On a page where CSS reorders elements, the two values differ, and swapping them silently targets the wrong control.
- Using CreationTime outside the Web environment. The property exists only on Browser objects. Applying it to a Page, Frame, or Window object throws an unsupported-property error.
- Hard-coding an ordinal into a shared function. A reusable function that assumes index:=2 becomes unusable the moment a second screen with a different layout calls it.
- Leaving ordinals in the repository after the application stabilises. Once developers add stable IDs, revisit the objects and replace the ordinal with the new property.
- Relying on ordinals inside loops over grids. Prefer
ChildObjects, which returns a live collection, so the count reflects the current page rather than the recorded one.
Resources
Download the Webpages used in the above tutorial for self-practise
Ordinal identifiers are one small piece of the object identification model. To see how they fit into the wider workflow, continue with the full QTP/UFT training series, review the fundamentals in software testing, learn how results are managed in the HP ALM tutorial, and compare locator strategies with the Selenium tutorial.
FAQs
Click here if the video is not accessible

