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 / How to click every ins...
Power Automate
Unanswered

How to click every instance of a UI element on a webpage

(0) ShareShare
ReportReport
Posted on by 28

I have a website with 6000+ search results and for each result, there is a PDF that I need to download and a button to generate that PDF (see screenshot below). Clicking that button results in the file downloading with the name that it needs to my download folder so it seems like it should  be a very simple automation - open the URL (which displays the search results), click every Generate PDF button on the page (the search results on each page can be set to up to 200), click Next Page and go through the process again until Next page is no longer an option. Seems simple, but I am new to Power Automate Desktop. I have the necessary licenses, but could someone point me in the right direction? 
2021-08-10_18-18-44.png

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    I am not familiar with clicking on redundant UI selectors; I know there is a way to say, click on 1st UI = Generate, click on next UI = Generate, but I don't know enough about it.

     

    If I were building this, I would assume this site accepts Send Keys {Tab} to use as a selector, and then I could go into a loop:

    Loop using LoopIndex 200 to 6000 increment of 200

    Loop using LoopIndex 1 to 200 increment of 1

    If LoopIndex = 1

    Send Keys {Tab} 'as many tabs as you need to get to the first Generate

    End If

    If LoopIndex >1

    Send Keys {Tab}{Tab}{Tab}{Tab}{Tab} 'looks like 5 tabs to get to your next Generate

    End If

    Send Keys {Return}

    Whatever other commands you need to save your file and get back to the website screen

    If LoopIndex = 200

    Send Keys {Tab} 'tabs to get the next page icon

    Send Keys {Return}

    End If

    End Loop

    End Loop

     

    Best of Luck.

  • joshlwulf Profile Picture
    28 on at

    Thanks so much for your quick response! That was just a part of the page so there are a lot of tabs to get to each button and although the examples I showed always have 5 tabs to get to the next Generate within that column of the table, that isn't always the case. Sometimes it might only be 2 and sometimes it could be more than 5. I think there are enough differences where I couldn't do any solutions based on tab counts and would need to do it based on the buttons. 

  • joshlwulf Profile Picture
    28 on at

    I updated the title for more clarity. 

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Can you share a snippet of the source code highlighting the selectors for at least 2 of the download links?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at
  • joshlwulf Profile Picture
    28 on at

    Sure. I'll add screenshots with context and the source code for those elements.

     

    1)

    2021-08-11_10-41-32.png

    <button _ngcontent-c1="" class="generate btn btn-link btn-sm" mattooltip="This will generate a single PDF for all files listed for this row" mattooltipclass="help_tip" mattooltipposition="above" aria-describedby="cdk-describedby-message-4" cdk-describedby-host="" style="touch-action: none; user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><svg _ngcontent-c1="" fill="rgb(33,150,243)" height="80%" role="img" viewBox="0 0 48 48" width="30%" xmlns="http://www.w3.org/2000/svg"><title _ngcontent-c1="">Generate PDF icon</title><path _ngcontent-c1="" d="M0 0h48v48H0z" fill="none"></path><path _ngcontent-c1="" d="M40 4H16c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h24c2.21 0 4-1.79 4-4V8c0-2.21-1.79-4-4-4zM23 19c0 1.66-1.34 3-3 3h-2v4h-3V14h5c1.66 0 3 1.34 3 3v2zm10 4c0 1.66-1.34 3-3 3h-5V14h5c1.66 0 3 1.34 3 3v6zm8-6h-3v2h3v3h-3v4h-3V14h6v3zm-23 2h2v-2h-2v2zM8 12H4v28c0 2.21 1.79 4 4 4h28v-4H8V12zm20 11h2v-6h-2v6z" fill="rgb(33,150,243)"></path></svg> Generate PDF </button>

     

    2)

    2021-08-11_10-42-10.png

    <button _ngcontent-c1="" class="generate btn btn-link btn-sm" mattooltip="This will generate a single PDF for all files listed for this row" mattooltipclass="help_tip" mattooltipposition="above" aria-describedby="cdk-describedby-message-4" cdk-describedby-host="" style="touch-action: none; user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><svg _ngcontent-c1="" fill="rgb(33,150,243)" height="80%" role="img" viewBox="0 0 48 48" width="30%" xmlns="http://www.w3.org/2000/svg"><title _ngcontent-c1="">Generate PDF icon</title><path _ngcontent-c1="" d="M0 0h48v48H0z" fill="none"></path><path _ngcontent-c1="" d="M40 4H16c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h24c2.21 0 4-1.79 4-4V8c0-2.21-1.79-4-4-4zM23 19c0 1.66-1.34 3-3 3h-2v4h-3V14h5c1.66 0 3 1.34 3 3v2zm10 4c0 1.66-1.34 3-3 3h-5V14h5c1.66 0 3 1.34 3 3v6zm8-6h-3v2h3v3h-3v4h-3V14h6v3zm-23 2h2v-2h-2v2zM8 12H4v28c0 2.21 1.79 4 4 4h28v-4H8V12zm20 11h2v-6h-2v6z" fill="rgb(33,150,243)"></path></svg> Generate PDF </button>
  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    More like this...on this page, here is reply button #1
    <a class="lia-button lia-button-primary" rel="nofollow" id="link_7" href="/t5/forums/replypage/board-id/MPADesktop/message-id/5862"><span>Reply</span></a>

     

    Here is reply button #2:
    <a class="lia-button lia-button-secondary reply-action-link lia-action-reply iconClass lia-button-slim" id="link_17" href="">Reply</a>

    And reply button #3:
    <input title="" class="lia-button lia-button-primary lia-button-Submit-action" value="Reply" id="submitContext_3a9954501ec803_0" name="submitContext_0" type="submit">

     

    I'm hoping yours is a little cleaner in the selector identifiers...for instance, if all 3 of these said value = Reply, then I believe we can use that to say, click on each iterance of "value = "Reply"".

     

    That's my thought process, and I know it is possible, just have to figure it out.

     

  • joshlwulf Profile Picture
    28 on at

    2021-08-11_10-41-32.png

  • joshlwulf Profile Picture
    28 on at

    2021-08-11_10-42-10.png

  • joshlwulf Profile Picture
    28 on at

    Sorry. Every time I tried to copy the source code or insert snippets, it wouldn't show up in the thread. The only way to make it work was to do screenshots.

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

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 233 Super User 2026 Season 2

#2
David_MA Profile Picture

David_MA 227 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 178

Last 30 days Overall leaderboard