Image comparison with WinAppDriver and Desktop Application

How can we compare image with WinAppDriver and Desktop Application? I am able to take the screen shot but cant compare. Tried to use Windows.getDriver().matchImagesFeatures(expectedScreenshot, actualScreenshot) but it did not work.

Hi, did this problem about compare images with winappDriver solved in your side? Can you share the solution? Thanks!
I want to compare the two images and wish it can mark the difference like used in WebUI.

Hi, for image comparison you will need to add OpenCV jar file from Here is code:
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.Point;
import org.opencv.core.Scalar;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;


  • Add jar file opencv-4.5.5-1.jar from

  • Template Matching
    public class ImageComparision {
    static {

    public static void templateMatching(String expectedScreenshot, String actualScreenshot) {
    Mat source = null;
    Mat template = null;

     source = Imgcodecs.imread(actualScreenshot,Imgproc.COLOR_BGR2RGB);
     template = Imgcodecs.imread(expectedScreenshot,Imgproc.COLOR_BGR2RGB);
     Mat outputImage = new Mat();
     int machMethod = Imgproc.TM_CCOEFF;
     //Template matching method
     Imgproc.matchTemplate(source, template, outputImage, machMethod);
     Core.MinMaxLocResult mmr = Core.minMaxLoc(outputImage);
     Point matchLoc = mmr.maxLoc;
     //Draw rectangle on result image
     Imgproc.rectangle(source, matchLoc, new Point(matchLoc.x + template.cols(),
     		matchLoc.y + template.rows()), new Scalar(0, 0, 255));
     Imgcodecs.imwrite("C://Katalon//ks_autotests//Screenshots//matchResult.jpg", source);


Thanks very much. It works.
And this also can work:`