← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #207285]: image comparison fails

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
--- but I'm looking for a more general approach so I can easily change the tested websites without touching the sikuli script.
Generally this is a good idea, but my (and other people's) experiences tell me, that this is usually combined with a huge scripting effort.
I think each Sikuli script will have some specifics about the images used (different browsers, resolutions, systems, ... ) that lead to different versions of the same script.
The only thing one should do: identify often used workflows and turn them in classes/methods/functions, that can be reused.

--- Which is one is more stable in terms of correct image comparision results?
I agree (and usually use) dinev's approach: looking for some key visuals, that should be there, to be sure, the workflow might proceed.
You might put this check in a function or functions, that accept some parameters (list of images, expected regions, combination logic, ...)

examples:

checkAll(images, reg = SCREEN):
    ret = True
    for image in images:
        if not reg.exists(image, 0):
            ret = False
            break
    return ret       

checkSome(images, reg = SCREEN):
    ret = False
    for image in images:
        if reg.exists(image, 0):
            ret = True
            break
    return ret

usage:

browser = App("your browser")       
if not checkAll( ("image1.png", "image2.png", "image3.png" ), browserApp.window() ):
     print "makes no sense to go on"; exit(1)

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