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

Sample – Scrape all images on website

July 25, 2022 · 2 min read

Danny Danny

This is a simple sample to scrape all images from a website by Python. While find_element of Clicknium is for locating a unique UI control, find_elements can be used to locate multiple UI controls with one locator. This example shows a basic usage scenario for this concept, and another blog shows advanced usage in capturing list of elements.

Scrape all images

  1. With the Clicknium recorder, record a locator for any image from the Clicknium homepage.
  2. Change the locator to match any image of the web page. As the below picture showing, keeping the tag property only and dropping the others. record
  3. With the updated locator, we can write the code as below to get all image elements in the web page and download them all. from clicknium import clicknium, locator
    import requests

    # open web page
    tab = clicknium.chrome.open("https://www.clicknium.com")

    # get all images by the locator
    imgs = tab.find_elements(locator.chrome.clicknium.img)

    # get image url from its property 'src'
    sources = []
    for img in imgs:
    source = img.get_property("src")
    if source:

    # download all images by the given src
    for source in sources:
    webs = requests.get(websiteUrl + source)
    open('images/' + source.split('/')[-1], 'wb').write(webs.content)


This sample shows a basic use case for locating multiple elements. To capture some more complicated elements, you may refer this blog to know how to implement it by using Clicknium ‘Similar elements’ feature.


Table of Contents

Table of contents
What are your feelings