Wednesday, October 14, 2015

Sikuli: check multiple of the same/duplicate images and choose the image to perform action

def by_y(match):

   return match.y


icons = findAll("Capture.PNG")



# sort the icons by their y coordinates and put them into a new variable sorted_icons

sorted_icons = sorted(icons, key=by_y)

# another shorter version is using lambda.

print sorted_icons[3]


# Iterate the images and hover it - To confirm

for icon in list(sorted_icons)[:2]:

    hover(icon)


#Click the 4th image from the list.

click(list(sorted_icons)[4])

No comments:

Post a Comment