← Back to team overview

sikuli-driver team mailing list archive

[Question #207273]: Creating an eitherOr method

 

New question #207273 on Sikuli:
https://answers.launchpad.net/sikuli/+question/207273

Hey

Been working with Sikuli for a while now and one method I started to need rather quickly was some kind of  "either or".  By this I mean a method that takes one or more images and returns a match if it can see any.

Was surprised to see Sikuli didn't appear to have this built in as it seems like a natural extension (unless I missed one :P), so I went ahead and made my own:

def eitherOr(imageList):
    for x in range(0, len(imageList)):
            if(exists(imageList[x], 0)):
                return imageList[x]
    FindFailed()

Now this is rather rough but it does work.  I use it mainly with 2 images, usually the two same links or buttons on different looking browsers. 

It's not perfect by any means.  It's main problem at the moment is if the first image is not found the exists call waits for some time (even with the 0 secs defined?) dragging the whole method down and increasing time exponentially.

So I was wondering what you guys thought about this and if there are any more efficient ways to do this?

Any help would be brilliant!  Thanks!

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