@Override public Match findElement(int numRetries) { Match match = null; for (int i = 0; i <= numRetries; i++) { try { Region region = labelObj .getLabelImageLocation() .getRegionOfImageObject(browser, labelObj.getLabelImage()); Assert.assertNotNull(region, "Failed to find Label '" + labelObj.getDisplayName() + "'."); match = new Match(region, 1); break; } catch (Throwable th) { if (i == numRetries) { Assert.fail( "Unable to find Label '" + labelObj.getDisplayName() + "'. Reason timeout(waited for " + (numRetries * 2) + " seconds).", th); break; } } browser.waitForSeconds(2); } return match; }
@Override public List<Match> findElements(int numRetries) { Region r = labelObj.getLabelImageLocation().getRegion(browser); return new ImageObject(UIObjectType.label, labelObj.getDisplayName(), labelObj.getLabelImage()) .getValidator(browser, r) .findElements(numRetries); }