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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Automate
Answered

IF and Loops

(0) ShareShare
ReportReport
Posted on by 6
Good afternoon, everyone okay? - English

I'm creating a flow in Power Automate Desktop, where I need to search for some product information on certain sites, but the site has several pages and to load more product options I need to press the "load more" button, to press this button I used the screen recording action. I would like to know how do I create a loop or an if formula in which it clicks on the "load more" button until it disappears and all the products appear to finally extract the data.
 
Thank you in advance for your help!
 
Boa tarde, todos bem? - Portugues
Estou criando um fluxo no Power Automate Desktop, onde o preciso buscar algumas informações de produtos em determinados sites, porém no site tem várias páginas e para carregar mais opções de produtos preciso apertar o botão "carregar mais", para apertar este botão utilizei a ação de gravação de tela. Eu gostaria de saber como faço para criar um loop ou uma formula if em que ele clique no botão "carregar mais" até que ele suma e apareça todos os produtos para enfim fazer a extração dos dados.
Desde já agradeço pela ajuda!
I have the same question (0)
  • Suggested answer
    eetuRobo Profile Picture
    4,220 Super User 2025 Season 2 on at
    Do something like this but just recapture the Button 'Show more' -element selector to be the "load more" button that your page has.


    You can try this code if you just copy paste it on empty flow:
    WebAutomation.LaunchEdge.LaunchEdge Url: $'''https://webflow.com/made-in-webflow''' WindowState: WebAutomation.BrowserWindowState.Normal ClearCache: False ClearCookies: False WaitForPageToLoadTimeout: 60 Timeout: 60 PiPUserDataFolderMode: WebAutomation.PiPUserDataFolderModeEnum.AutomaticProfile TargetDesktop: $'''{\"DisplayName\":\"Local computer\",\"Route\":{\"ServerType\":\"Local\",\"ServerAddress\":\"\"}}''' BrowserInstance=> Browser
    SET ButtonExists TO True
    LOOP WHILE (ButtonExists) = (True)
        IF (WebAutomation.IfWebPageContains.WebPageContainsElement BrowserInstance: Browser Control: appmask['Web Page \'https://webflow.com/made-in-webflow\'']['Button \'Show more\'']) THEN
            WebAutomation.PressButton.PressButton BrowserInstance: Browser Control: appmask['Web Page \'https://webflow.com/made-in-webflow\'']['Button \'Show more\''] WaitForPageToLoadTimeout: 60
        ELSE
            SET ButtonExists TO False
        END
    END
    
    # [ControlRepository][PowerAutomateDesktop]
    
    {
      "ControlRepositorySymbols": [
        {
          "IgnoreImagesOnSerialization": false,
          "ImportMetadata": {
            "DisplayName": "Local computer",
            "ConnectionString": "",
            "Type": "Local",
            "DesktopType": "local"
          },
          "Name": "appmask"
        }
      ],
      "ImageRepositorySymbol": {
        "Repository": "{\r\n  \"Folders\": [],\r\n  \"Images\": [],\r\n  \"Version\": 1\r\n}",
        "ImportMetadata": {},
        "Name": "imgrepo"
      },
      "ConnectionReferences": []
    }
    
    It opens demo site that has "Show more" button on it.


    Another way you could do it would be with javascript function on web page. First copy the selector 



    Then insert the selector to below: INSERT SELECTOR HERE


     function ExecuteScript() {

            // Define the selector

            const showMoreButton = document.querySelector("INSERT SELECTOR HERE");



            if (showMoreButton) {

                showMoreButton.click();



                setTimeout(ExecuteScript, 1000);

            }

        } 

    And put that in you Run JavaScript function on web page
  • FB-25101909-0 Profile Picture
    6 on at
    That was exactly it!
     
    Thank you very much and have a great day!!!!
     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 507 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 267 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard