Can I use Visual Relation Identifiers in LeanFT?

  • Questions
  • Can I use Visual Relation Identifiers in LeanFT?
Question ID: 106409

I used Visual Relation identifiers in UFT. Can I use them in LeanFT too?

Marked as spam
Posted by (Questions: 338, Answers: 20)
Asked on September 17, 2015 5:30 pm
Answers (1)
Private answer

Yes, you can. Using as an example, the code below is going to click the ''Google Search'' button using the ''I'm Feeling Lucky'' button VRI object.

First you need to create test object for your VRI object, then create a test object based on it's visual relation to your VRI object.

(Please note this will only work on the page if Instant Predictions are turned OFF in Search Settings on Google, otherwise as soon as data is entered into the search field, the buttons will disappear)

public void TestInitialize()
//Create the browser object
IBrowser browser = BrowserFactory.Launch(BrowserType.Firefox);


//Describe known objects
var luckyButton = browser.Describe(new ButtonDescription
ButtonType = @''submit'',
TagName = @''INPUT'',
Name = @''I'm Feeling Lucky''

var searchField = browser.Describe(new EditFieldDescription
Type = @''text'',
TagName = @''INPUT'',
Name = @''q''

//Set up the VRI
var searchButton = browser.Describe(
new ButtonDescription
ButtonType = ''Submit'',
Vri =
new VisualRelation
TestObject = luckyButton,
HorizontalRelation = HorizontalVisualRelation.RightAndInline,

//Enter Data in the Search Field

//Click the Search button using VRI

Here's a link with more info on how to use VRI: [][1]

As noted on that page, you can also create VRI definitions in the Application Model Editor. For more info about the Application Model Editor, check out this post: [][2]


Marked as spam
Posted by (Questions: 16, Answers: 748)
Answered on September 17, 2015 5:34 pm
So awesome! That will help me a lot!
( at September 17, 2015 5:40 pm)