🍺 Join Clicknium for quality support, growth opportunities, and a supportive community

Capture Similar Elements

Using the Okay Bear image in Opensea as an example, which is a typical Grid structure.

a. Click the Capture button in the VS Code plugin to start the Recorder:

b. Click on Similar elements in the Recorder:

c. Ctrl + mouse click to grab the first and second elements.:

After crawling the locator corresponding to the similar elements, call find_elements to return a UI element list (find_element returns a single UI element.

Sample code: #

Get the picture URL by get_property. Download the picture using request lib, and use send_hotkey to press the PgDn key to scroll and load more picture.

import requests
from time import sleep
from clicknium import clicknium as cc, locator
def main():
nftDic = {}

while True:
newDic = {}
finish = True
nfts = cc.find_elements(locator.sample.opensea.img_okay_bear)
for nft in nfts:
src = nft.get_property("src")
name = nft.get_property("alt")
if name not in nftDic:
finish = False

for key,value in newDic.items():
r = requests.get(value)
print("Downloading:"+ key)
imagePath = ".\image\" + key + ".jpg"
with open(imagePath,'wb') as f:

nftDic = nftDic | newDic
if finish:
print("next page")

if __name__ == "__main__":
What are your feelings
Table of contents
Updated on 24 November 2023