← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #681126]: Problem with wait(Pattern)

 

Question #681126 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/681126

Sahil Doshi posted a new comment:
I have a wrapper over method.

public Match custWaitForImage(final Pattern image, final double waitInMinute)
			throws FindFailed, InterruptedException {
		try {
			double endTime = System.currentTimeMillis() + (waitInMinute * 60 * 1000);

                        screen.saveScreenCapture(loggingFolder,
"log_before");

                        screen.wait(image, waitInMinute * 60);

			while (System.currentTimeMillis() <= endTime && !screen.has(image)) {
				TimeUnit.SECONDS.sleep(1);
			}

			if (!screen.has(image)) { // at this line has returns false
				throw new FindFailed(FindFailed.createErrorMessage(this, image.getImage()));
			}

			return screen.getLastMatch();
		} finally {
			screen.saveScreenCapture(loggingFolder, "log_after");
		}
	}

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.