How to use loop

Asked by Ankit Jain

Below is my script, please help for a specified method below:

from __future__ import with_statement
from sikuli.Sikuli import *
addImagePath("feedback.sikuli")
class trydoc(object):
    def startApp(self):
        openApp("C:\\Program Files\\Microsoft Office\\Office14\\WINWORD.EXE")
        while not exists("Pr00fGuru-1.png"):
            sleep(5)
    def signIn(self):
        click("Pr00fGuru.png")
        click("TTY.png")
        wait(5)
        while not exists("GuruEditinga.png"):
            sleep(5)
        click("IZITIBIIIU.png")
        type("<email address hidden>\t")
        type("ankit1")
        click("1344849244764.png")
        wait(2)
        click("1344917954201.png")
        while not exists("IryasamplePr.png"):
            sleep(5)
        click("1344918008136.png")
    def checking(self):
     ----- In this method i want to implement loop like wherever sikuli finds image say (image.png) it clicks on (image2.png) & where it finds (image3.png) it clicks on (image4.png) also, this loop must run until sikuli finds (image5.png)

    def runTest(self):
        self.startApp()
        self.signIn()
        #self.verifyFeedback()
        #self.verifySuggestion()
        #verifyCancel()
if __name__ == "__main__":
    tryIt= trydoc()
    tryIt.runTest()

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
Ankit Jain (ankit4655) said :
#1

thanks in advance.

Revision history for this message
Best RaiMan (raimund-hocke) said :
#2

while not exists(image5, 0):
     if exists(image, 0): click(image2)
     if exists(image3, 0): click(image4)
     wait(1)

Revision history for this message
Ankit Jain (ankit4655) said :
#3

Thanks RaiMan, that solved my question.