Share this page

VisualRelation Class
Class representing Visual Relations Identifier (VRI) data. Each VisualRelation class contains a reference to a test object, and up to three possible relations: horizontal relation, vertical relation, and proximity relation.
Remarks
See the UFT Developer Help Center for more information on VRI, including a diagram that illustrates the way UFT Developer interprets visual relations and the boundaries that are used for determining in-line related objects.

C# Syntax

    public class VisualRelation

Example

    // Locate button number 1 in the calculator based on the location of buttons number 2 and 4.
    var button1 = calculator.Describe<IButton>(
        new ButtonDescription
        {
            NativeClass = "Button",
            Vri =
                {
                    new VisualRelation
                    {
                        // Button number 2 is to the right of button number 1.
                        TestObject = button2,
                        HorizontalRelation = HorizontalVisualRelation.Right,
                    },
                    new VisualRelation
                    {
                        // Button number 4 is above the button number 1.
                        TestObject = button4,
                        VerticalRelation = VerticalVisualRelation.Above,
                    }
                }
        });

    var usernameLabel = browser.Describe<IWebElement>(new WebElementDescription
    {
        TagName = @"TD",
        InnerText = @"User Name:"
    });
    browser.Describe<IEditField>(new EditFieldDescription
    {
        Vri =
            {
                new VisualRelation{
                    TestObject = usernameLabel,
                     HorizontalRelation = HorizontalVisualRelation.LeftAndInline
                }
            }
    }).SetValue("mercury");

Inheritance Hierarchy

System.Object
HP.LFT.SDK.VisualRelation

Public Constructors

| Name | Description
--- | --- | ---
| VisualRelation Constructor | Initializes a new instance of the VisualRelation class with null values for all 3 relation elements.

Top
Public Properties

| Name | Description
--- | --- | ---
| HorizontalRelation | The horizontal relation definition.
| ProximityRelation | The proximity relation definition.
| TestObject | The related test object.
| VerticalRelation | The vertical relation defintion.

Top
Public Methods

| Name | Description
--- | --- | ---
| Clone | Creates an exact copy of this object.

Top

Tips to improve your search results... UFT Developer .NET SDK Reference Version 15.0-15.0.2 UFT Developer SDK Reference All View Local Help Center View Online Help Center back Go back in browser history forward Go forward in browser history Remove search highlights next topic Go to next topic previous topic Go to previous topic Print the current topic Version: