Package qa.justtestlah.visual
Class AppiumTemplateMatcher
- java.lang.Object
-
- qa.justtestlah.visual.AppiumTemplateMatcher
-
- All Implemented Interfaces:
TemplateMatcher
@Component public class AppiumTemplateMatcher extends Object implements TemplateMatcher
Implementation ofTemplateMatcher
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 Summary
Constructors Constructor Description AppiumTemplateMatcher(ImageUtils imageUtils)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Match
match(String targetFile, String templateFile, double threshold)
Check whether the template appears anywhere within the target image.Match
match(String targetFile, String templateFile, double threshold, String description)
Check whether the template appears anywhere within the target image.void
setDriver(org.openqa.selenium.WebDriver driver)
-
-
-
Constructor Detail
-
AppiumTemplateMatcher
@Autowired public AppiumTemplateMatcher(ImageUtils imageUtils)
- Parameters:
imageUtils
-ImageUtils
-
-
Method Detail
-
setDriver
public void setDriver(org.openqa.selenium.WebDriver driver)
-
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 interfaceTemplateMatcher
- Parameters:
targetFile
- path to the target filetemplateFile
- path to the template filethreshold
- 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 interfaceTemplateMatcher
- Parameters:
targetFile
- path to the target filetemplateFile
- path to the template filethreshold
- matching thresholddescription
- of the check- Returns:
Match
-
-