Micro Focus QTP (UFT) Forums

Full Version: Achieving Visual Relation Identifier option using AOM
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I want to find a text box which is placed in left of Label for the text box. If I use OR, then I will achieve as shown in screenshot attached. But I want to do the same within the scripts itself using Automation Object Model.

Any ideas? How to achieve this?
Thanks...
Done using below code.
Code:
Dim VisualRelation, RelationToTextBox, TextBoxDesc
Set VisualRelation = VisualRelations.Create
Set RelationToTextBox = VisualRelation.Add
RelationToTextBox.relatedobjectpath = "JavaWindow(""title:=Main"").JavaStaticText(""label:=Box1"")"
RelationToTextBox.relativeposition = micRelLeft
RelationToTextBox.setargument micRelInline, True

Set TextBoxDesc = Description.Create
TextBoxDesc("Class Name").Value = "JavaEdit"
TextBoxDesc("visual relations").Value = VisualRelation
JavaWindow("title:=Main").JavaEdit(TextBoxDesc).Type "val"