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 Platform Community / Forums / Power Automate / How to press a button ...
Power Automate
Unanswered

How to press a button in a table based on the dynamic date value

(0) ShareShare
ReportReport
Posted on by 92

    Good day to everyone! I need to make PAD press an "Actions" button in a table (as you can see on the screenshot) based on a date value in that same table. I have an Excel table with all the transactions (and their dates) that I need to mark as chargeback by pressing the "Actions" button.

    When I was extracting the data from cells in the first row (to inspect the elements in Selector) I noticed that both of them (the date and button) have the same tr[Id="-row-1"] attribute. My thoughts were to extract that "-row-1" value from the date cells and place it to the button Selector. But I can't figure it out. I am using the "Extract data from webpage" action in PAD to extract Text value from the date cells (on a screenshot). Then I need to compare those date values with the date from the Excel file, so I get the right transaction. And after that, I need to extract the "-row-1" attribute value of that specific date cell and put it into a variable. Finally, I should insert this variable into the button Selector so the PAD can click the button.

    Maybe there is an easier way to do this, but I haven't found one yet. The main thing for me now is to get that "-row-1" attribute value. I will attach more screenshots below. Will be glad to see your thoughts.

I have the same question (0)
  • TheAnker Profile Picture
    92 on at

    Here are the Selectors for the date cell and the button and advanced settings of Extract data from a webpage 3.png4.png5.png

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Try extracting it into a table instead of a list. When you do that, you'll have several columns. 

     

    Base CSS selector: html > body > div > div:eq(2) > div:eq(1) > div > div:eq(3) > div > div > div:eq(1) > div:eq(0) > div:eq(1) > div:eq(1) > table > tbody

     

    For the date:

    CSS selector: tr > td:eq(1)

    Attribute: Own Text

     

    For the row Id:

    CSS selector: tr

    Attribute: Id

     

    This should return the dates and the Ids in a single table with two columns. You can then build a loop to iterate through the rows in the table, processing them one by one.

     

    As to how to pass a variable value to a selector, see this article: https://learn.microsoft.com/en-us/power-automate/desktop-flows/build-custom-selectors#use-variables-in-a-custom-selector

    As well as this great video: https://www.youtube.com/watch?v=2PcyBa22Jj8&ab_channel=Thomas%22Shaky%22Petersen

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

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

  • TheAnker Profile Picture
    92 on at

    Hello Agnius! I took your advice and chose a table instead of a list in advanced settings, but it only picked the first row. Or is that the way it's supposed to be?

    8.png

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

    Okay, in that case try moving the tr part to the base CSS selector:

     

    Base CSS selector: html > body > div > div:eq(2) > div:eq(1) > div > div:eq(3) > div > div > div:eq(1) > div:eq(0) > div:eq(1) > div:eq(1) > table > tbody > tr

     

    For the date:

    CSS selector: td:eq(1)

    Attribute: Own Text

     

    For the row Id:

    CSS selector: (blank)

    Attribute: Id

     

    Not quite sure if it will accept a blank CSS selector for the row. If this doesn't work, you'll need to extract two separate lists then and then use an index when iterating through one to get a value from the other one.

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

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

  • TheAnker Profile Picture
    92 on at

    Oh yeah, that worked well! Giga thanks for the help Agnius. I think I can work my way from here now.

    10.png

  • TheAnker Profile Picture
    92 on at

        And for anyone who wants to know what to do next to make PAD press the Actions button I will post a few screenshots.

        Once I have a table with dates and row IDs, I need to compare those dates to the date from my Excel spreadsheet (I have previously put that date into the TRX_Date variable) so it can select the correct Actions button. 11.png

    12.png13.png14.png

        These are the steps and their details. So I am searching for the needed date in "Find or replace in data table", comparing it to my TRX_Date from Excel and the resulting table DataTableMatches has only 1 row and 2 columns, i.e. the index of the found date in the form [4][0] for example (the column starts from 0, as well as the row, here is a post that helped me to understand the concept).

        The next step is to convert this value in a cell (which is stored as text) to a number. After that, I need to get the "-row-1" value from DateAndRowID and put it into a variable. I did it to tell PAD which button it should press. The last screenshot is from Selectors (I added the Actions button to the UI elements window previously). The last action is just clicking on another link that pops up after I click on the button (same steps here, I added %RowName% variable to the Selector).

        Hope that it helped someone who struggled with a similar problem. 👍👍👍

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Awesome! Thanks for sharing your steps here.

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard