Save images from website to a local directory

I want to save images stored on a website to a local directory. It works fine when I try to do it for only one image.
But I have a list of image elements with class = ‘img’. I want to save all of them to my local directory.
I request you to please help me with my current scenario.

Thank you.

In which part of the workflow do you have issues exactly?
If you have Xpaths of the elements saved int he list, you can iterate through them using For Each loop.

I have 5 images stored on webpage with style height 17px
i tried //img[@style=‘height:17px;’] and saved to string and saved the image locally that means it works fine for one image.
but when i save above result to list and loop through it then not working for even one and when i check i get blank values in element of loop.

please see the image below for the html of images
image

1 Like

If you know there are 5 images on the page, you can put the actions to download the images in the Repeat loop and use the element’s index (saved in variable “counter” in the example below) to access it.



You can read about using XPaths for lists of elements in the XPath guide: https://kb.workfusion.com/display/RPAe/XPath+Guide#XPathGuide-ListsofElements

No the number of images is not fixed its dynamic.
There might be 1 or 2 or 5 or even none.

So probably what i need is to find the number of elements with same height and then loop through that number of times to get all the images.

You can use For Each loop in this case.

Save all elements wit this Xpath to a List variable, and then download each using For Each loop