Sikuli 检查屏幕上出现两个不同的图像

Sikuli check two different images appear on screen

我一直在网上搜索解决方案,但没有找到这个具体问题。我需要 Sikuli 在屏幕上同时定位两个图像,虽然没有发生,但执行一个操作:

while not ( exists (refSet.getImage("image1")) & exists(refSet.getImage("image2")) ):
        click(Pattern(refSet.getImage("image3")))

while not exists ( (refSet.getImage("image1")) & (refSet.getImage("image2")) ):
        click(Pattern(refSet.getImage("image3")))

我遇到一个错误:

TypeError:& 的操作数类型不受支持:'org.sikuli.script.Match' 和 'NoneType'

有人知道怎么解决吗?感谢您的帮助。

万一有人需要它,我解决了它创建我自己的功能,但更好的想法表示赞赏!

def findTwoImages(self, image1, image2):
    bBoth = False
    imageCount = 0
    if exists(refSet.getImage(image1)): 
       imageCount += 1
    if exists(refSet.getImage(image2)):
       imageCount += 1
    if (imageCount == 2):
       bBoth = True 
    return bBoth