Relevant for: GUI tests and components
In addition to learning the mandatory and assistive properties specified in the Object Identification Dialog Box, UFT can also learn a backup ordinal identifier for each test object. The ordinal identifier assigns the object a numerical value that indicates its order relative to other objects with an otherwise identical description (objects that have the same values for all properties specified in the mandatory and assistive property lists). This ordered value enables UFT to create a unique description when the mandatory and assistive properties are not sufficient to do so.
The assigned ordinal property value is a relative value and is accurate only in relation to the other objects displayed when UFT learns an object. Therefore, changes in the layout or composition of your application page or screen can cause this value to change, even though the object itself has not changed in any way. For this reason, UFT learns a value for this backup ordinal identifier only when it cannot create a unique description using all available mandatory and assistive properties.
In addition, even if UFT learns an ordinal identifier, it will use the identifier during the run session only if:
The learned description and the Smart Identification mechanism are not sufficient to identify the object in your application.
A visual relation identifier is not defined for the test object. For details, see Visual relation identifiers.
While learning an object, UFT can assign a value to the test object's Index property to uniquely identify the object. The value is based on the order in which the object appears within the source code. The first occurrence is 0.
Index property values are object-specific. Therefore, if you use Index:=3 to describe a WebEdit test object, UFT searches for the fourth WebEdit object in the page. However, if you use Index:=3 to describe a WebElement object, UFT searches for the fourth Web object on the page—regardless of the type—because the WebElement object applies to all Web objects.
For example, suppose a page contains the following objects:
An image with the name Apple
An image with the name UserName
A WebEdit object with the name UserName
An image with the name Password
A WebEdit object with the name Password
The following statement refers to the third item in the list, as this is the first WebEdit object on the page with the name UserName:
In contrast, the following statement refers to the second item in the list, as that is the first object of any type (WebElement) with the name UserName:
While learning an object, UFT can assign a value to the test object's Location property to uniquely identify the object. 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 left to right.
In the following example, the radio buttons in the dialog box are numbered according to their Location property:
Location property values are object-specific. Therefore, if you use Location:=3 to describe a WinButton test object, UFT searches from top to bottom, and left to right for the fourth WinButton object in the page. However, if you use Location:=3 to describe a WinObject object, UFT searches from top to bottom, and left to right for the fourth standard object on the page—regardless of the type—because the WinObject object applies to all standard objects.
Creation time identifers
While learning a browser object, UFT assigns a value to the CreationTime . This value indicates the order in which the browser was opened relative to other open browsers. The first browser that opens receives the value CreationTime = 0.
During the run session, if UFT is unable to identify a browser object based solely on its test object description, it examines the order in which the browsers were opened, and then uses the CreationTime property to identify the correct one.
Example: For example, if UFT learns three browsers that are opened at 9:01 pm, 9:03 pm, and 9:05 pm, UFT assigns the CreationTime values, as follows: CreationTime = 0 to the 9:01 am browser, CreationTime = 1 to the 9:03 am browser, and CreationTime = 2 to the 9:06 am browser.
At 10:30 pm, when you run a test or component with these browser objects, suppose the browsers are opened at 10:31 pm, 10:33 pm, and 10:34 pm. UFT identifies the browsers, as follows: the 10:31 pm browser is identified with the Browser test object with CreationTime = 0, 10:33 pm browser is identified with the test object with CreationTime = 1, 10:34 pm browser is identified with the test object with CreationTime = 2.
If a step was created on a Browser object with a specific CreationTime value, but during a run session there is no open browser with that CreationTime value, the step will run on the browser that has the highest CreationTime value. For example, if a step was created on a Browser object with CreationTime = 6, but during the run session there are only two open browsers, with CreationTime = 0 and CreationTime = 1, then the step runs on the last browser opened, which in this example is the browser with CreationTime = 1.
Note: It is possible that at a particular time during a session, the available CreationTime values may not be sequential. For example, if you open six browsers during a record or run session, and then during that session, you close the second and fourth browsers (CreationTime values 1 and 3), then at the end of the session, the open browsers will be those with CreationTime values 0, 2, 4, and 5.