First of all, you don’t need to perform a feature-based comparison. You can use the
findElemetByImage() method implemented by the
Second, you will need to specify that the template image (the image to be found) needs to be scaled, and specify the scaling factor; otherwise, the method will not find it as its bigger than the one in the screenshot. And since the big image is a screenshot, you don’t need to take it.
So, in your case, you will need to perform something like this:
File template = new File("./appium_thumbs_up.png");
WebElement e = driver.findElementByImage(
Set the scale value that works for you to match the template to the size of the image to be found within the screenshot. Then, play with the
IMAGE_MATCH_THRESHOLD setting to find what value works best for you (in my code, I am able to make comparisons with a match threshold of up to 0.98).
If you cannot find the method for your case, then do an occurrence comparison instead of a feature-based. The former is to be used when the image to be found is a subset of the target/screenshot; the latter is to be used when the image to be found is basically the same as the target but rotated and/or scaled.
You can find an example on the page you mentioned at the beginning. Notice that you need to get the score from the result of the comparison and determine whether it meets the threshold that you think best.
Hope this helps.