在Sikuli中,如何查找并单击至少3张相同的图像? [英] In Sikuli, How to find and click a minimum of 3 identical images?

查看:171
本文介绍了在Sikuli中,如何查找并单击至少3张相同的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图单击不少于3张相同的图像,但是使用findAll()时,我想让sikuli很难只选择1张图像,而我却不想选择3张图像(如果没有3张图像)或更多.

I'm trying to click no less than 3 of the same image, but with findAll() I am having difficulty with sikuli wanting to select only 1 image when I don't want it to select any if there is not 3 or more.

if exists(Pattern("1474201252795.png").similar(0.95)):
    wait(1)
    for x in findAll(Pattern("1474201252795.png").similar(0.95)):
        click(x)

推荐答案

因此,请先对图像进行计数,然后检查计数是否大于3.

So just count the images first and check if the count is higher than 3.

imageCount=0

images = []

# find all images and store them in a list to prevent additional search
for image in findAll("Win7StartBtn.png"):
    images.append(image)

#check list length and act accordingly
if len(images) >= 3:
    for image in images:
        image.click()

这篇关于在Sikuli中,如何查找并单击至少3张相同的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆