Class AppiumTemplateMatcher

  • All Implemented Interfaces:
    AppiumTemplateMatcher, TemplateMatcher

    @Component
    @Primary
    @ConditionalOnProperty(value="opencv.mode",
                           havingValue="server",
                           matchIfMissing=true)
    public class AppiumTemplateMatcher
    extends Object
    implements AppiumTemplateMatcher
    Implementation of TemplateMatcher using Appium's image locator (which uses OpenCV on the appium server)

    This class provides methods to check whether a given image (template) is part of another one (target). We use a simple (yet effective) way to detect the template image in various sizes by scaling the target up and down to a minimum and maximum size.

    • Constructor Detail

      • AppiumTemplateMatcher

        public AppiumTemplateMatcher()
    • Method Detail

      • match

        public Match match​(String targetFile,
                           String templateFile,
                           double threshold)
        Description copied from interface: TemplateMatcher
        Check whether the template appears anywhere within the target image.
        Specified by:
        match in interface TemplateMatcher
        Parameters:
        targetFile - path to the target file
        templateFile - path to the template file
        threshold - matching threshold
        Returns:
        Match
      • match

        public Match match​(String targetFile,
                           String templateFile,
                           double threshold,
                           String description)
        Description copied from interface: TemplateMatcher
        Check whether the template appears anywhere within the target image.
        Specified by:
        match in interface TemplateMatcher
        Parameters:
        targetFile - path to the target file
        templateFile - path to the template file
        threshold - matching threshold
        description - of the check
        Returns:
        Match