continue Loop after break

Asked by alex

 #look when one of the two image appear.
while True:
      wait(2)
      print ('Searching...')
      if exists ("1498307221873.png",0):
          print "Found E"
                #break loop
          continue
      elif exists ("1498307427007.png",0):
          print "Found D"
          continue
                #break
      else:
          print " Waiting..."
          wait(30)
          click("1498306719179.png")
          pass

why after "Found E" the Sikuli exit and not continue loop?

Question information

Language:
English Edit question
Status:
Expired
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was reopened

  • by alex
Revision history for this message
masuo (masuo-ohara) said :
#1

I copied your codes, capture image on my environment, and run.
It worked that it continue loop after "Found E".

Revision history for this message
alex (alexdniel88) said :
#3

while True:
      wait(5)
      print ('Searching...')
      if exists (Pattern("1498380448500.png").exact(),0):
          print "Found Egg"
                #break loop
          continue
      elif exists (Pattern("1498307427007.png").exact(),0):
          print "Found D"
          hover(Location(1140,110))
          click(hover)
          doubleClick("1498310619746.png")
          click(Pattern("1498310847322.png").similar(0.90))
          wait(15)
          doubleClick("1498310619746.png")
          click(Pattern("1498310803864.png").similar(0.90))

          hover(Location(1140,110))
          click(hover)
          continue
                #break
      else:
          print "waiting...."
          wait(10)
          click("1498380513851.png")
          sleep (2)
          pass

why im getting this error ?
Searching...

Found Egg

Searching...

Found Egg

Searching...

waiting....

[log] CLICK on L(967,553)@S(0)[0,0 1280x800]

Searching...

waiting....

[log] CLICK on L(967,553)@S(0)[0,0 1280x800]

[debug] MouseDown: extended delay: 30211

[debug] MouseUp: extended delay: 10037

Searching...

waiting....

[error] script [ testing2 ]] stopped with error at line --unknown--
[error] Could not evaluate error source nor reason. Analyze StackTrace!
[error]

java.lang.InterruptedException: sleep interrupted
 at java.lang.Thread.sleep(Native Method)
 at java.awt.Robot.delay(Robot.java:427)
 at org.sikuli.script.RobotDesktop.delay(RobotDesktop.java:227)
 at java.awt.Robot.autoDelay(Robot.java:413)
 at java.awt.Robot.afterEvent(Robot.java:363)
 at java.awt.Robot.mouseRelease(Robot.java:204)
 at org.sikuli.script.RobotDesktop.doMouseUp(RobotDesktop.java:90)
 at org.sikuli.script.RobotDesktop.mouseUp(RobotDesktop.java:201)
 at org.sikuli.script.Mouse.up(Mouse.java:392)
 at org.sikuli.script.Mouse.up(Mouse.java:376)
 at org.sikuli.script.Mouse.reset(Mouse.java:103)
 at org.sikuli.script.Sikulix.cleanUp(Sikulix.java:485)
 at org.sikuli.ide.SikuliIDE$ButtonRun$1.run(SikuliIDE.java:2385)

Revision history for this message
masuo (masuo-ohara) said :
#4

I think that if you explain your environment(OS, Java version, SikuliX version) you may get answer earlier.

Revision history for this message
Launchpad Janitor (janitor) said :
#5

This question was expired because it remained in the 'Needs information' state without activity for the last 15 days.