Programmatic Description for Visual Relation Identification

  • Questions
  • Programmatic Description for Visual Relation Identification
Question ID: 106773

What do I put in a programmatic description for an object that is identified by visual relations? The object is to the right and horizontally in-line with a label object (Web Element)

Marked as spam
Posted by (Questions: 44, Answers: 0)
Asked on April 20, 2016 8:58 pm
Answers (1)
Private answer

You would have to create a VisualRelations object. This is defined in the Object Model Reference for GUI Testing > Utility Objects > VisualRelations Object > Create Method.

Below is the sample from the UFT 12 help manual for the create method.


Create Method

Returns an empty VisualRelationsCollection Object, which you can use to define the related objects for a test object's visual relation identifier.

setVRIColl = VisualRelations.Create

The following example demonstrates the use of a VisualRelations collection with a test object that has an ambiguous programmatic description. The same test object is used to represent different buttons in the calculator application based on the relative position of the buttons to the left and right of that button. Using these settings, the example below clicks on buttons 2, 5, and 8 in the calculator. (The example assumes that all objects from the calculator application have been added to the object repository.)

For i = 2 to 8 step 3

print ''Now selecting the object that matches button '' & i & '' via the related buttons '' & (i-1) & '' and '' & (i+1)

'Define an ambiguous button object on the calculator.

Set obj = Window(''text:=Calculator'').WinButton(''text:=.*'')

'Define two visual relations for the current button.

Marked as spam
Posted by (Questions: 2, Answers: 98)
Answered on April 20, 2016 8:59 pm