cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
keyurpsspl
Frequent Visitor

Get a images from web page

Is there any option to get count/html of all images in a specific table/webpage using power automate desktop?

2 REPLIES 2
burque505
Helper V
Helper V

@keyurpsspl1, you can do it with the 'Run JavaScript function on webpage action.

I don't have any affiliation with this website, I just picked it at random because it had multiple images.

You'll need to do more processing if you want to get the URLs of the images into Excel or some other program, but maybe this will get you started.

 

images_flow.png

This is the code for the first function:

 

 

 

 

 

function ExecuteScript() { 
var imagez = document.getElementsByTagName("img");
return imagez.length;
}

 

 

 

 

 

'imagez.length' is the count of images, but as a number. If you want to display it you need to convert it to text first (see flow).

The second function grabs the URL of the first image on the page. Then it's displayed in a message box.

 

 

 

 

 

function ExecuteScript() { 
var imagez = document.getElementsByTagName("img");
return imagez[0].src;
}

 

 

 

 

 

You can also experiment with 'Get details of element on web page'. This is often (some might say always) a better approach. You can modify the selector to use variables, of course.

Attributes-flow.png

Saving the best for last, you can 'Extract data from webpage'.

 

extract.png

Here I just grabbed all the images on the page and stored the URLs in an Excel sheet. If you need the count, you can count the rows with an Excel action.

A couple of video links for this action:

Extract data from webpage 

Price extraction 

Nice post on the forum by @Ameer 

fraenK
Memorable Member
Memorable Member

Just simple two lines does it all:

WebAutomation.DataExtraction.ExtractList BrowserInstance: Browser Control: $'''img''' ExtractionParameters: {['', 'Source Link', ''] } ExtractedData=> DataFromWebPage
SET ImgNum TO DataFromWebPage.RowsCount

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events happening this month - don't miss out!

 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Top Solution Authors
Users online (4,992)