In Sikuli, How to find and click a minimum of 3 identical images?

眉间皱痕 提交于 2019-12-23 02:09:07

问题


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)

回答1:


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()


来源:https://stackoverflow.com/questions/39583103/in-sikuli-how-to-find-and-click-a-minimum-of-3-identical-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!