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
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (3,890)