As the name says, Visual relation identifier is a method to identify the object based on the neighbour objects. It works on the properties of the objects which are near to them. This feature is found very useful in few of the cases. If we take the example of webTable class in web based applications , it comes out to be the best feature. We can define the visual relationship identifiers, which can be set in both local and shared object repositories.
We can use VRI in both the ways that is descriptive programming and through configuring QTP manually.
->Through Descriptive Programming :
-> Through configuring in QTP manually :
Hortizontal – Enables you to tell QTP to id objects according to their hortizontal location in relation to the field to be indentified. You’ll have two options (Left and Right)
and an In line (horizontal) checkbox option.
Vertical – Enables QTP to find related objects based on their vertical location relative to the object you want to identify. It also has two options (Above and Below) and a In Line (vertical) checkbox option.
Distance and Hierarchy – Enables QTP to find related objects based on their distance to the location of the object you want to identify. It has four options: Closest on the X-axis, Closest o n the Y-axis, Closest on both axes and Contains.
Some Important points to remember about visual relation identifier are:
1. Visual relation identifier are taken into consideration if object is not uniquely identified using the object identification Properties(SI ,Ordinal Identifier ,etc).
2. Visual relation identifier have preference on smart identification for object recognition.
3. Ordinal Identifiers are ignored if visual relation identifier is defined for an object.
4. Visual Relation identifier are created for an object based on relative position of other stable object, i.e. objects existing left, right, top , bottom relative to object to be identified can be used for relative identifier.
5. Relative Objects should exist in object repository before a relation can be created if we are not using DP.
6. This is used to filter in case of multiple objects in the application matching object definition but are placed relative to other object in application.
7. If no objects in the application match the test object’s description properties, then the visual relation identifier you defined is ignored.
8. Visual relation identifiers are not supported for WebService test objects.
We can use VRI in both the ways that is descriptive programming and through configuring QTP manually.
->Through Descriptive Programming :
Set rc = VisualRelations.Create
Set relation = rc.Add
relation.relatedobjectpath = "Browser(""micclass:=Browser"").Page(""micclass:=Page"").WebElement(""innertext:=Art"",""html tag:=LABEL"",""index:=0"")"
relation.relativeposition = micRelRight
relation.setargument micrelinline, True
Set des=Description.Create
des.Add "micclass","WebCheckBox"
des.Add "visual relations",rc
Browser("micclass:=Browser").Page("micclass:=Page").WebCheckbox(des).highlight
Set relation = Nothing
Set rc=Nothing
-> Through configuring in QTP manually :
In the QTP object repository click to on the visual identifier setting’s click to add

On the Visual Relation Identifier screen click on the + plus sign under the preview button:

Point to the object you want to use to help QTP identify the field you need to recognize

Point to that object in relation to which you want to define a object through VRI.

Three Visual Relation Identifier detail options:
When you bring up the Visual Relation Identifier you’ll have three main categories (under Relation Details) to choose from: Horizontal, Vertical and Distance and Hierarchy.Hortizontal – Enables you to tell QTP to id objects according to their hortizontal location in relation to the field to be indentified. You’ll have two options (Left and Right)
and an In line (horizontal) checkbox option.
Vertical – Enables QTP to find related objects based on their vertical location relative to the object you want to identify. It also has two options (Above and Below) and a In Line (vertical) checkbox option.
Distance and Hierarchy – Enables QTP to find related objects based on their distance to the location of the object you want to identify. It has four options: Closest on the X-axis, Closest o n the Y-axis, Closest on both axes and Contains.
Some Important points to remember about visual relation identifier are:
1. Visual relation identifier are taken into consideration if object is not uniquely identified using the object identification Properties(SI ,Ordinal Identifier ,etc).
2. Visual relation identifier have preference on smart identification for object recognition.
3. Ordinal Identifiers are ignored if visual relation identifier is defined for an object.
4. Visual Relation identifier are created for an object based on relative position of other stable object, i.e. objects existing left, right, top , bottom relative to object to be identified can be used for relative identifier.
5. Relative Objects should exist in object repository before a relation can be created if we are not using DP.
6. This is used to filter in case of multiple objects in the application matching object definition but are placed relative to other object in application.
7. If no objects in the application match the test object’s description properties, then the visual relation identifier you defined is ignored.
8. Visual relation identifiers are not supported for WebService test objects.
No comments:
Post a Comment