How to highlight the image matched on the mobile app

Hi all,

Is it possible to hihghlight the matched image on the mobile app with image recognition feature?

coz i am trying to find an element by image and the image is found but it does not tap on the found image

i tried below code but does not seems working so want to try highlighting and see where the match is found on the mobile app.

 MobileElement Addsettoprofile = (MobileElement) driver.findElement(MobileBy.image(Addset));
     Point location= Addsettoprofile.getLocation();
        TouchAction a3 = new TouchAction(driver);
        PointOption pointOption = new PointOption();
        a3.tap(PointOption.point(location)).perform();

Do not know what is wrong.

first problem add ‘release’

        MobileElement Addsettoprofile = (MobileElement) driver.findElement(MobileBy.image(Addset));
        Point location= Addsettoprofile.getLocation();
        TouchAction a3 = new TouchAction(driver);
        PointOption pointOption = new PointOption();
        a3.tap(PointOption.point(location)).release().perform();

second problem tap in CENTER! not left upper corner!

        MobileElement Addsettoprofile = (MobileElement) driver.findElement(MobileBy.image(Addset));
        new TouchAction(driver)
                .tap(PointOption.point(
                        Addsettoprofile.getCenter().x, Addsettoprofile.getCenter().y))
                .release().perform();

third try also:

        new TouchAction(driver)
                .press(PointOption.point(
                        Addsettoprofile.getCenter().x, Addsettoprofile.getCenter().y))
                // a bit more reliable when we add small wait
                .waitAction(WaitOptions.waitOptions(Duration.ofMillis(50)))
                .release().perform();

Hi Aleksei,

Than you for the suggestion the second solution worked for me but when i took a proper selection from the appium screenshot. But i followed the same steps for another element and it does not work but click somewhere on the screen where i do not want it to click so just wanted to highlight the area where appium is tapping to so that i know what i need to adjust for x and y co-ordinates.

if you are with android you can enable show touches in debug menu.

No i am on iOS, is there a similar option for iOS?

@Aleksei
I mentioned in my message above that i am facing issue with an element not found , even tough other elements which i interact with are working and all the images are taken in same fashion, so why appium is not able to find one element? Also i am using the Appium settings mentioned below:

    driver.setSetting(Setting.IMAGE_MATCH_THRESHOLD, 0.2);
    driver.setSetting(Setting.FIX_IMAGE_TEMPLATE_SIZE, true);  

But still it does not make any difference. What can i do , so that Appium recognize each and every images on the Mobile App?

sorry. In never used Appium image search. Last time i did it myself with OpenCV and it was … 5y ago.