Search in sources :

Example 11 with FindFailed

use of org.sikuli.script.FindFailed in project sakuli by ConSol.

the class RegionImpl method waitForImage.

/**
 * {@link Region#waitForImage(String, int)} ()}
 */
public RegionImpl waitForImage(String imageName, int seconds) {
    Match match;
    ImageLibObject imageObj = loadImage(imageName);
    try {
        match = this.wait(imageObj.getPattern(), seconds);
    } catch (FindFailed findFailed) {
        match = null;
    }
    if (match != null) {
        return toRegion(match);
    }
    loader.getExceptionHandler().handleException("Can't find \"" + imageObj + "\" in" + this + "waitFor function in " + seconds + " sec.", this, resumeOnException);
    return null;
}
Also used : ImageLibObject(org.sakuli.datamodel.actions.ImageLibObject) FindFailed(org.sikuli.script.FindFailed) Match(org.sikuli.script.Match)

Aggregations

FindFailed (org.sikuli.script.FindFailed)11 Location (org.sikuli.script.Location)4 Ignore (org.junit.Ignore)3 Test (org.junit.Test)3 WebElement (org.openqa.selenium.WebElement)3 Match (org.sikuli.script.Match)3 Pattern (org.sikuli.script.Pattern)2 File (java.io.File)1 IOException (java.io.IOException)1 Boolean (java.lang.Boolean)1 RuntimeException (java.lang.RuntimeException)1 ArrayList (java.util.ArrayList)1 Dimension (org.openqa.selenium.Dimension)1 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)1 ImageLibObject (org.sakuli.datamodel.actions.ImageLibObject)1 Screen (org.sikuli.script.Screen)1 Test (org.testng.annotations.Test)1