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 Platform Community / Forums / Power Automate / Creating a loop for mu...
Power Automate
Answered

Creating a loop for multiple pages

(0) ShareShare
ReportReport
Posted on by 26

Because of how our website is built I am unable to use code to stop the pager from clicking the next button when itโ€™s at the end. So can someone tell me how to build a loop I can place a count on to control how many times a UI ELEMENT CLICKS to the next button l. As it scraps each web page I need it stored in the a table and extracted to excel at the end. This I believe will help with my next button issue. Sorry I am new to power automate. 

I have the same question (0)
  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Instead of using the paging functionality of the Extract data from web page, create a new data table, loop through all of your pages, extracting each of them individually and appending the values to your data table.

     

    See this video guide for a sample on how to do it: https://www.youtube.com/watch?v=yvoUBwCqdn0

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution.
    If you like my response, please give it a Thumbs Up.

    If you are interested in Power Automate, you might want to follow me on LinkedIn at https://www.linkedin.com/in/agnius-bartninkas/

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • Steve48 Profile Picture
    431 on at

    I am also a newbie and had this problem too. I used aLoop condition and set the first operand and second operand both = true. So no there is an infinite loop. Inside the loop. Inside my loop I used Get Details of Element on Webpage. the element was the Next Button. I got an attribute called "disabled" which is false until the last page.

    My next action was  an if then to test whether the attribute was true. If yes I used Go To a label to go to a label which was outside the loop. The key is to put a test inside the loop that detects that you are on the last page.  In my case I was able to check for an attribute. You might be able to test for anUI element not being present- the next button? hope this helps

  • Verified answer
    Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    This is one of the ways to do it. I would only suggest using an Exit loop action instead of a Go toLabel.

     

    Alternatively, one can also try extracting a total number of results available (if that number is available somewhere) and divide that by the number of pages. Then round the result and use the number in the loop. 

     

    It is also sometimes possible to pass the page index to the URL and then do that while incrementing the page index until the page does not load (or has no results).

     

    It can also be possible to check if the results are the same as from the previous page, or if the page number is the same as from the previous page, indicating that pressing the Next page button did not really take us to the next page.

     

    Plenty of ways to do it. Usually depends on the page.

     

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 484

#2
11manish Profile Picture

11manish 282

#3
David_MA Profile Picture

David_MA 280 Super User 2026 Season 1

Last 30 days Overall leaderboard