web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Answered

Get number of HTML tags on a website

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello there!

I am working on a flow in power automate desktop that extracts information from a website. The info spreads over several pages so I need to go through the different pages. I am having trouble getting Extract Data from Web Page with pagination working so I wanted to count the number of pages and manually open the URL for each page. Since the number of pages can vary I need to know what the last page number is. For example in the picture below the last page number is '10' (but in other scenarios it might be more or less). I tried executing a JavaScript function within my flow to count the number of <lI> tags within the <ul> without much success. Does anyone have any idea or suggestions how i could get the last page number or alternatively how to work extracting data with pagination? 

 

TIA! 

Screen Shot 2020-11-14 at 5.45.58 pm.png

Screen Shot 2020-11-14 at 5.44.49 pm.png

I have the same question (0)
  • PetrosF-MSFT Profile Picture
    Microsoft Employee on at

    Hi @Anonymous 

     

    You could try extracting the text of the last list item (10 in this case) using jQuery selectors - https://www.w3schools.com/jquery/jquery_ref_selectors.asp

     

    I hope that helps!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Unfortunately not because it’s not always going to be 10 pages 🙃

     

    i figured out another way however I’d still be interested in an answer for this!

  • Verified answer
    PetrosF-MSFT Profile Picture
    Microsoft Employee on at

    Hi @Anonymous 

     

    Alternatively, you could use the "Run javascript on webpage action" and execute a JS code like the following:

    function ExecuteScript() {
    var x = document.querySelectorAll("...beginning of your CSS selector.....ul.pagination li").length;
    return x;
    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 269 Super User 2026 Season 2

#2
trice602 Profile Picture

trice602 184 Super User 2026 Season 2

#3
11manish Profile Picture

11manish 136 Super User 2026 Season 2

Last 30 days Overall leaderboard