Micro Focus QTP (UFT) Forums
Achieving Visual Relation Identifier option using AOM - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Achieving Visual Relation Identifier option using AOM (/Thread-Achieving-Visual-Relation-Identifier-option-using-AOM)



Achieving Visual Relation Identifier option using AOM - scsvel - 02-17-2012

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...


RE: Achieving Visual Relation Identifier option using AOM - scsvel - 02-17-2012

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"