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

    Status: Answered => Open

Leonardo Carvalho Sobral dos Santos is still having a problem:
Ok,

I'm using Sikuli ide to make scripts

This is a part of my scripts;

def monthView():

    try:
        
        find("1386607213938.png")
        click("1386607213938.png")
        sleep(3)

        while exists("1386591483816.png"):
                find("1386591501792.png")
                click("1386591501792.png")
                sleep(3)
        if exists("1386674062665.png"):
            find("1386674062665.png")
            click("1386674062665.png")

        else: 
            print("Error to find month button")
            
        
        if exists(Pattern("1386674929878.png").similar(0.80)):
            print("Calendar opened in month view")
            dragDrop("1386676773871.png", "1386676778404.png")
            if exists("1386676800162.png"):
                print("Calendar opened in month view")
            else:
                print("error:Calendar opened in month view")
                raise exception
        else: 
            print("error:Calendar opened in month view")
            raise exception
        
    except:
        raise exception


##########Tests Suits######################


testOk = 0;
testNok = 0;

try:
       .
       .
       .

    monthView()
    print("Test 11 - Passed")
    testOk = testOk +1;

except:

    print("Test 11 Failed")
    testNok = testNok +1;

    .
    .
    .

print ("Test OK",testOk)
print ("Test Not OK",testNok)



So the way you said , I would change to


def takeShot(filename):
try:
    import shutil
    shutil.move(capture(SCREEN), filename))
except:
     raise exception
def monthView():

    try:
        
        find("1386607213938.png")
        click("1386607213938.png")
        sleep(3)

        while exists("1386591483816.png"):
                find("1386591501792.png")
                click("1386591501792.png")
                sleep(3)
        if exists("1386674062665.png"):
            find("1386674062665.png")
            click("1386674062665.png")

        else: 
            print("Error to find month button")
            
        
        if exists(Pattern("1386674929878.png").similar(0.80)):
            print("Calendar opened in month view")
            dragDrop("1386676773871.png", "1386676778404.png")
            if exists("1386676800162.png"):
                print("Calendar opened in month view")
            else:
                print("error:Calendar opened in month view")
                raise exception
        else: 
            print("error:Calendar opened in month view")
            raise exception
        
    except:
        raise exception

##########Tests Suits######################


testOk = 0;
testNok = 0;

try:
       .
       .
       .

    monthView()
    print("Test 11 - Passed")
    takeShot(filename)
    testOk = testOk +1;

except:

    print("Test 11 Failed")
    takeShot(filename)
    testNok = testNok +1;

    .
    .
    .

print ("Test OK",testOk)
print ("Test Not OK",testNok)

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

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to