
Hi All,
I am quite new with Power Automate Desktop, I would need some help regarding dynamically built websites.
The short story:
There are items listed on a dynamic website, each item has an EDIT and DEL icon that I need to press:
The number of items listed are not known in advance.
(Sidenote: the last step is to add/edit items based on details from an XLS sheet, to edit the items on this webpage to match the items in the XLS sheet.)
My difficulty is how handle the UI elements on a dynamic webpage as the items IDs are different every time.
First, I manually added the EDIT and DEL icons as UI elements. It did not work right away, but I managed to figure it out how to change the Selectors (initially set by the Capture UI Element functionality) by unselecting some of the attributes used in the Selector Builder to make the "Press the buttons" actions working.
But as mentioned the webpage is built dynamically:
in the web page source code every item has a unique numeric ID, which is needed to identify the related UI elements for the different items, for example, one of the needed selector:
div[Id="main-item-845"]
Unfortunately, these numeric item IDs are changed every single time when this page is loaded. Currently it is 845 for the first item, but next time it will be e.g. 2210 for the same first item.
The flow needs to be able to go through all the items to EDIT/DELETE them.
I guess to automatise my flow and to be able to edit/del items on this dynamic webpage, 2 things are needed:
Could anybody kindly help me out with the Nr. 1 task?
I only could save the web page source to a %WebPageProperty% variable by the "Get details of web page" action, but could not go further to create a list variable with the numeric IDs.
I would need a detailed solution, how to find all the
strings in the web page source stored in the %WebPageProperty% variable and how to extract all the numeric IDs (3, 4 or 5 digit-longs) from them and to store them in a LIST variable, called %ItemIDsLIST%
I would highly appreciate a solution detailed.
Thank you.
Hi @Anonymous
You'll want to use the "Extract data from web page" command in PAD, and have it attach to your browser instance generated earlier in your flow.
First run your flow up to the step before getting this data, then stop your flow, so you have the browser at the window/table you're going to work with and the instance should be saved within PAD. Then, edit the "Extract data from web page" command in PAD and set the first field to have it attach to the browser instance you're using. While that command is open in PAD, click on/change windows to your browser instance, and PAD will give you a popup window that will let you select elements of the web page to extract (similar to the UI selector).
If you CTRL click on one of the numeric item ID's, and then CTRL click on a different numeric item ID in the same column, the helper pop up window will identify all of the numeric item ID's in that field from the table, for extraction. You can also click other elements of the table in the same way, to extract more fields at the same time (up to 3 total?).
Personally, I prefer to store the extracted data in a variable, and then use the [0] etc references to pull specific items from the list or table, but I haven't found a great explanation of how the [0] references work within a list variable or a table variable. You can have it put the extracted data into an excel file instead, if that's more comfortable.
Good luck, hope that helps!
PRatcliff