Does LeanFT have an Insight capability like UFT does?
Question ID: 106410
1
0

UFT does not recognize some of our application’s objects. We had to use Insight recording for some of them. Can LeanFT do this as well?

Marked as spam
Posted by (Questions: 386, Answers: 64)
Asked on September 17, 2015 7:21 pm
107 views
Answers (1)
1
Private answer

Yes, you can create an InsightObject and use it. Here's an example using Google.com's ''Google Search'' button.

First you have to create your image file. For image objects on a web page, you usually can just right-click it and save the image. For other objects you'll have to capture it somehow and save as a JPEG, BMP or PNG file. I just used Jing to capture the Google Search button and saved it to my project folder.
![alt text][1]

Now, create the InsightObject in the code of your test. At the top of the test, include:

using System.Drawing;
using HP.LFT.SDK.Insight;

You may also have to right-click the References in the Solution Explorer and include the System.Drawing Assembly.

[TestInitialize]
public void TestInitialize()
{
//Create a browser object of type FireFox

IBrowser browser = BrowserFactory.Launch(BrowserType.Firefox);

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

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

string bitmapFolder = ''{image location}\googleSearch.png'';

Image image = Image.FromFile(bitmapFolder);
var searchButton = browser.Describe(new InsightDescription(image));

searchField.SetValue(''eyeontesting'');
searchButton.Click();
}

There is a Similarity property you can use to determine the % tolerance. Change the code line above to include the percentage you want to use:

var searchButton = browser.Describe(new InsightDescription(image, 75));

This will change the similarity tolerance from the default of 80% to 75%.

[1]: /storage/temp/352-googlesearch.png

Marked as spam
Posted by (Questions: 16, Answers: 807)
Answered on September 17, 2015 7:24 pm
0
That's great, going to help us a lot with LeanFT!
( at September 17, 2015 7:25 pm)
EyeOnTesting

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

X
Scroll to Top