← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #210742]: if exists and assert exists are not behaving same

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Might be, that the hovering mouse forces the entry to look different.

So try to move the mouse somewhere else before.

Or if you only want to use the exists() stae from before with the assert
(no extra search:

something like:

found = exists(Pattern("39W Anchor Loadset Unselected Version.png").similar(0.99)) or exists(Pattern("39W Anchor Loadset Selected Version.png").similar(0.99))
if found:
            getLastMatch().highlight(2)
            #print getLastMatch()
            hover(getLastMatch())

....

assert(found)

BTW: It seems you are searching on the whole screen, which is slow and error prone.
and if "Unselected" is not found, it waits the full 3 seconds before looking for "Selected"
So in worst case the check "exists() or exists()" lasts about 4 seconds.

- restrict the searches to a region and use reg.exists() and reg.getLastMatch()
- use exists(image, 0) to search only once (no need to wait)

both together might reduce the processing time to 1 - 0.5 seconds and
below depending on the size of the search region.

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