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

    Status: Open => Answered

Eugene S proposed the following answer:
Hi,

That's perhaps a general recommendation on debugging Sikuli scripts
rather than the answer to your specific problem but still might prove
useful. So when something doesn't work as expected, you can try the
following steps to better understand what is actually going on.

1. First of all, wait times are often the issue. When something goes
wrong, first step is to place some sleep times between steps. Don't
forget that Sikuli doesn't wait for any action to complete and performs
the next line straight away. In some cases that might miss a minor
change on the screen and thus fail. A simple "time.sleep(waitTime)" will
work.

2. When debugging, it is crucial to know exactly where are you in your script 
as the failure might occur not where you think it is. To help with that I am 
suggesting to place few print statements in between the steps saying what is 
happening at this specific moment.
For example:

print "Going to click on image1"
click "image1.png"
print "image1 clicked

print "Going to wait for image2"
wait("image2.png")
print "image2 found"

3. Depending on your Sikuli MinSimilarity parameter, some areas might be
incorrectly detected. Meaning that the pattern was found on the screen
which is not the one you expected. To solve that, you might want to use
highlight() function which will put a red frame around the eras on the
screen that was detected.

For example:
area1 = "image1.png"
foundPattern = find(area1)
foundPattern.highlight(1)  # show the red frame for one second


Hope that helps.


Cheers,
Eugene

-- 
You received this question notification because your team Sikuli Drivers
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