Ask a Question

Regions.Compare with Masks

New Contributor

Regions.Compare with Masks

I am using Regions.Compare method in an If condition for branching between two different scenarios based on the displayed window. I don't use Check because it takes a longer time to process and generates a log error that terminates the script. Is there any way to include masks while using Compare? or is there any other way to compare a region as a branching condition (not as a region checkpoint) and still be able to use masks?

Esteemed Contributor

Well,first of all, I don't like having "Stop on error" set to true... I like to have more granular control over when my automation stops.  So, if turn that off, then Regions.Check would work for you.


You could go the route of Picture.Compare (


It's a bit different than Region compare... you wouldn't have a stored region in the system, you'd be using an external picture file loaded in.  I use this freqently and does pretty well.

Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

Hi, @ezzmonem 


Is it an option to use the Picture.Compare method?

Picture.Compare allows a mask to be used


In my scripts I use a combination of the and method


if (!pic_1.Compare(pic_2, ............., maskImg))


Regions.Compare(pic_1, pic_2)





New Contributor



Thank you for your help!

PictureObject.Compare worked fine with masks.

I implemented it this way:

var appRegion = Regions.CreateRegionInfo(
AObject, 0, 0, width, height, false);

var baselinePicture= Regions.GetPicture("baseline_1");
var baselineMask= Regions.GetPicture("baseline_1_Mask");


if(baselinePicture.Compare(appRegion .Picture(), false, 0, false, 0, baselineMask)){




Showing results for 
Search instead for 
Did you mean: