/** * do a findAll op with the given image or the given text in the Finder's image * (hasNext() and next() will reveal possible match results) * @param imageOrText iamge file name or text * @return null. if find setup not possible */ public String findAll(String imageOrText) { if (!valid) { log(-1, "not valid"); return null; } Image img = Image.create(imageOrText); _image = img; if (img.isText()) { return findAllText(imageOrText); } if (img.isValid()) { return findAll(img); } return null; }
/** * getCoords returns a list of coordinates of all the matches found for the element specified * @param targetImgPath is the image of the element that you want to find * @return list of coordinates of the matches found for the element specified */ public List<Point2D> getCoordsForAllMatchingElements(String targetImgPath) { Finder f = new Finder(takeScreenshot()); List<Point2D> coordsList = new ArrayList<>(); Match m; f.findAll(targetImgPath); while (f.hasNext()) { m = f.next(); coordsList.add(new Point2D.Double(m.getTarget().getX(), m.getTarget().getY())); } return coordsList; }