What are strategies to construct reusable Sikuli screen shot libraries?

后端 未结 4 1611
-上瘾入骨i
-上瘾入骨i 2021-01-31 06:20

I would like to use Sikuli to automate both GUI apps and Web apps running within browser on Mac OS X and Windows. My purpose is currently less for testing, and more for GUI auto

4条回答
  •  借酒劲吻你
    2021-01-31 06:51

    Maybe this will give you some idea's.
    I have a file where I have multiple definition that need to look for a certain image.
    Somethimes the image they need to look for is different in different browsers.
    So I use something like this:

    File: ImageLib.sikuli

    browser_Windows_Firefox = ("windowsFox.png")
    browser_Mac_Firefox = ("macFox.png")
    

    File: Execute.sikuli

    from ImageLib import *
    
    # Variable you can get set somewhere 
    operatingSystem = 'Mac'
    
    image = ()
    if (operatingSystem == 'Windows'):
        image = browser_Windows_Firefox
    elif (operatingSystem == 'Mac'):
        image = browser_Mac_Firefox
    else:
        # Unknow option here.... 
        pass
    
    # Find and highlight it. 
    imageLoc = find(image)
    imageLoc.highlight(5)
    

提交回复
热议问题