← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #578448]: if exists (A, 0), if exists (B, 0) not working within a loop

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
sorry, not possible to see, where you might have a problem, based on
such code snippets.

If a script does not respond anymore this is usually due to an infinite
loop, that only has an expected workflow, but does not have any
precautions for not expected situations.

When using exists(), you have to be careful, since you do not get any
feedback about problems with FindFailed exceptions.

So in doubt every

if exists():

should have a corresponding 
else:

where you take corrective actions or break a loop with related
information.

Another option is to use the user logging feature, to track your
workflow.

BTW: (version 1.1.1):
         if regphone.exists(Image):
                regphone.click(Image)
  
can be replaced by:
         if regphone.exists(Image):
                regphone.click() # clicks lastmatch in regphone

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