Visual Relational Identifier in leanft in C sharp

Visual relational identifiers are used to identify the objects in relation with other objects on the screen. Visual relational identifiers feature was added in UFT. LeanFT also supports it and helps us to identify objects relative to x and y axis. We can create Visual relational identifiers (VRI) in 2 ways.
  • Description programming
  • Using application model
To understand the VRI feature in a better way, consider below image. Suppose developer has not given any unique property to the button 2. Also imagine that developer has only given unique properties to the button 1 and 5. We can easily find the button 2 object using VRI feature in this scenario. We know that button 2 is located to the right of button 1 and below button 5. This information is enough to identify the button button 2.
 
var button2 = calculator.Describe<IButton>(
    new ButtonDescription
        {
        NativeClass = "Button",
        Vri =
             //button 1 is to the left of button 2 
                {
            new Relation
                        {
                TestObject = button1,
                HorizontalRelation = HorizontalVriRelation.Left,
            },
          //button 5 is to above button 2 
            new Relation
                        {                  
                TestObject = button5,
                VerticalRelation = VerticalVriRelation.Above,
                        }
                }
    });
    
In similar way, we can add relations in Object identification center. Below image shows how we can add VRI properties to identify the test objects using application model editor (Similar to the Object repository manager in UFT/QTP)

Web development and Automation testing

solutions delivered!!