fixImageTemplateSize doesn't seem to work

Hi everyone,

I am using findElementByImage(), and I run tests on both Emulator and the real device. The images on the device are 3times smaller than on emulator. So I thought to use DEFAULT_IMAGE_TEMPLATE_SCALE setting, having same template images.
I also tried it with the following settings:
driver.setSetting(Setting.FIX_IMAGE_TEMPLATE_SCALE, true);
driver.setSetting(Setting.FIX_IMAGE_TEMPLATE_SIZE, true);
but no luck so far.

Can’t you just scale the Emulator to the device size? You don’t say what Emulator you are using but I think they all have that setting.

The problem is that it may vary depending on which emulator it is gonna be run on. I just thought opencv4nodejs supports image comparison with even different resolutions.

I have the following devices I run on :
windowSize: (1600, 2464) - Nexus emulator
windowSize: (1200, 1920) - Samsung real android tablet
windowSize: (1024, 1366) - iPad simulator
windowSize: (768, 1024) - iPad mini simulator
With the same template icons it runs successfully on different size iPads, but fails on android.

Ok, that’s interesting. I wonder if on Android if it’s just not scaling properly? But I don’t know why that would be since this is a third party library. It should be operating system agnostic. Maybe the underlying automation code, like UiAutomator2, has some additional methods around this?

The main settings related to resize and scaling should work on both platforms. There are some more android specific settings, which doesn’t seem relevant.
But thanks for your help!

how you made original image against what compare? maybe make it with Android and iOS two different?

Original/template image I made first time taking a screenshot of an element and using them later to findElementByImage. I tried both on emulator/and the real device.
On iOS the pixel difference is not considered, it is finding the image on screen successfully even with different sizes.
On android each screen has to have exact same resolution image.
And yes, also think keeping device specific templates for android is the way.