← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #265845]: how to use loop for taking screen shots till a image appears

 

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

    Status: Open => Answered

Jeremy proposed the following answer:
If I'm reading it right, this is what I do:


int error_count = 0;
while(s.exists(screenImage,0) == null){
Thread.sleep(500);
error_count++;
//sometimeout number
if (error_count > 10)
return false; //program was stuck and didn't work. Try again.
}

I usually have other fanciness that happens so I put in a timeout or
looking for other options.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.