Can I use Visual Relation Identifiers in LeanFT?
Question ID: 106409
1
0

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

Marked as spam
Posted by (Questions: 387, Answers: 66)
Asked on September 17, 2015 5:30 pm
132 views
Answers (1)
1
Private answer

Yes, you can. Using Google.com 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 Google.com 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)

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

browser.Navigate(''http://www.google.com'');

//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
searchField.SetValue(''eyeontesting'');

//Click the Search button using VRI
searchButton.Click();
}

Here's a link with more info on how to use VRI: [http://leanft-help.saas.hp.com/en/12.50/HelpCenter/Content/HowTo/VRI.htm][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: [http://eyeontesting.com/questions/9738/how-to-quickly-add-aut-objects-to-leanft.html][2]

[1]: http://leanft-help.saas.hp.com/en/12.50/HelpCenter/Content/HowTo/VRI.htm
[2]: http://eyeontesting.com/questions/9738/how-to-quickly-add-aut-objects-to-leanft.html

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

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top