2

I am trying to check if a certain image (the output of a a test result) exists in a browser session.

I am using the C# SDK.

Following an example of code from Micro Focus, the verification procedure uses a line of code like one that follows the remarks:

Point?: point = browser.VerifyImageExists(imageToFind);

The issue I have is: how can I check the contents of the variable point, and which data type it has?

I am using the UFT LeanFT version 14.03.

AustinWBryan
  • 3,249
  • 3
  • 24
  • 42

1 Answers1

1

According to the documentation:

Nullable<Point> VerifyImageExists( 
   Image imageToFind,
   byte similarity
)

Return Value
the Point where the image was located, or null if it was not found.

So the return value is a nullable of type System.Drawing.Point.

Usage:

Point? point = browser.VerifyImageExists(imageToFind);
if (point.HasValue) {
    Console.WriteLine("Image found at {0}", point.Value);
}
else {
    Console.WriteLine("Image not found");
}
Motti
  • 110,860
  • 49
  • 189
  • 262
  • @Adelin, I linked to which point, but you're right, it'll be better to explicitly say so in the answer. – Motti Jul 03 '18 at 07:26
  • The code runs Motti but the result is always not found; I'm just doing a proof of concept searching an image on a Google page; My starting point was a JPEG google searched image (I had to transform it on bmp for LeanFT to use it) – Jose M Cardoso Jul 03 '18 at 09:06
  • @JoseMCardoso Try adding a similarity, perhaps the conversion from JPEG to BMG changed it a bit. – Motti Jul 03 '18 at 09:22
  • I guess it did< I lowered Granularity just to 45 and it didn't work. Anyhow I will try to reuse the code later in another proof of concept with no image manipulation, – Jose M Cardoso Jul 03 '18 at 09:57
  • Don't know why it didn't work. I tried a different approach and issue got solved. Used the Insight functions and achieved to determine where an image was, the image format could be a *.png – Jose M Cardoso Jul 09 '18 at 08:58