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