VRI - visual relational identifier in leanft in Java

This is the advanced feature in UFT and LeanFT that allows you to identify the objects based upon the position of adjacent objects. For example in below image we can identify the edit box using text associated with it.Here is the complete example that shows how to use VRI in LeanFT. Note that we can provide multiple visual relational identifiers to identify a object.
package leanft;

import com.hp.lft.report.Reporter;
import com.hp.lft.report.Status;
import com.hp.lft.sdk.HorizontalVisualRelation;
import com.hp.lft.sdk.VisualRelation;
import com.hp.lft.sdk.web.*;
import org.junit.Test;

public class VriTest extends BaseTest {

    public void test() throws Exception{

        Browser browser = BrowserFactory.launch(BrowserType.CHROME);
            //Navigate to https://www.softpost.org/selenium-test-page/

            //set value in edit box
            browser.describe(EditField.class,new EditFieldDescription.Builder()

            WebElement e2 = browser.describe(WebElement.class,new WebElementDescription.Builder()
                    .xpath("//td[text()='Last Name']").build());

            browser.describe(EditField.class,new EditFieldDescription.Builder()
                    .vri(new VisualRelation().setTestObject(e2).

            //click on Home link
            browser.describe(Link.class, new LinkDescription.Builder()

            //Wait until page loads
        catch(AssertionError ex){
           //Report the Exception
           Reporter.reportEvent("Exception","Test failed", Status.Failed, ex);
           throw ex;
            //Close the browser

Complex problems, Simple Solutions