【问题标题】:Sikuli check two different images appear on screenSikuli 检查两个不同的图像出现在屏幕上
【发布时间】:2016-01-21 16:38:44
【问题描述】:

我一直在网上搜索解决方案,但没有找到这个具体问题。我需要 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' 的操作数类型不受支持

有人知道如何解决这个问题吗?感谢您的帮助。

【问题讨论】:

    标签: sikuli


    【解决方案1】:

    如果有人需要它,我会创建自己的函数来解决它,但我们会感谢更好的想法!

    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
    

    【讨论】:

    • 使用布尔值可能会更好,并制作两个变量... if(first_image && second_image) both = true
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-12-10
    • 2017-09-20
    • 2016-11-06
    • 2020-12-11
    • 2020-03-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多