← 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

RaiMan proposed the following answer:
ok, thanks.
as far as I understand your logic:

example: waitInMinute = 1

double endTime = System.currentTimeMillis() + (waitInMinute * 60 * 1000);
endTime will be now + 1 Minute

screen.wait(image, waitInMinute * 60);
since you do not get a FindFailed here the image gets visible within 1 minute.

   while (System.currentTimeMillis() <= endTime && !screen.has(image)) {
    TimeUnit.SECONDS.sleep(1);
   }
now you you wait until now reaches endTime if Image is not visible
... but the image should be visible in that moment (the wait before succeeded), hence the loop is skipped.

... but if has() would return false (being a bug), then you would wait
here until endtime is reached or has() does not return false anymore.

conclusion in case of has() works correctly (what I checked and IMHO it
does):

at this time:
if (!screen.has(image))

the image is no longer visible.

... ok, all this simply makes no sense.

I guess, you never see a failing wait, because you do not have a
catch(FindFailed), but only a try...finally.

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