Share this page

# Insight code sample (.NET SDK)

In this topic:

## Identify and activate an image object

The following example uses Insight to identify and activate an image object, and clicks the 2 button on the calculator.

To run this test:

- The calculator application must be open; and
- A bitmap of button number 2 on the calculator must be stored on the directory in which the test is running.

    using System.Drawing;
    using System.IO;
    using NUnit.Framework;
    using HP.LFT.SDK;
    using HP.LFT.SDK.StdWin;
    using HP.LFT.SDK.Insight;

    .
    .
    .

    [Test]
    public void TestCalcWithInsight()
    {
    	var calculatorDescription = new WindowDescription
    	{
    		WindowClassRegExp = "CalcFrame",
    		WindowTitleRegExp = "Calculator"
    	};
    	// Identify the calculator application.
    	IWindow calculator = Desktop.Describe<IWindow>(calculatorDescription);
    	// Locate the bitmap.string bitmapFolder = Directory.GetCurrentDirectory() + "\\TwoButton.bmp";
    	Image image = Image.FromFile(bitmapFolder);
    	var twoButton = calculator.Describe<IInsightObject>(new InsightDescription(image));
    	twoButton.ClickSpecial(); //Click the number "2" button.

    }

Back to top

https://admhelp.microfocus.com Functional Testing for Developers 8942
Tips to improve your search results... OpenText™ Functional Testing for Developers Help Center OpenText™ Functional Testing for Developers Help 25.2 All View Local Help Center View Online Help Center Version: