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 target UI eleme...
Power Automate
Unanswered

How to target UI elements that change their div/span name dynamically?

(0) ShareShare
ReportReport
Posted on by 1
Hello! I have set up a Power Automate flow where it does the following:

1. reads domains from a list,
2. for each domain in the list, it generates the URL text of several pages in a website that provides SEO metrics (let's call it seosite.com)
3. then opens the Edge browser for each URL and retrieves specific data with the "Get details of element on webpage" action
4. uses the UI element data to update an Excel sheet.

My issue is that the span name in seosite.com changes dynamically, for example, if the DR value for a specific page if it's 74, then the span element will be named as "Span 74". Therefore the automation easily breaks because it doesn't reliably select the data for each domain.

I have heard that this may be solved with XPath even though I'm not familiar with it, and I don't know how to generate the XML file for each URL, and as far as I know, the particular site doesn't provide an XML for each page. Is there an option to generate an XML file automatically for each page?

I also heard that this might also be solved with javascript if the naming pattern is properly identified, but I'm not sure if this is a scalable solution as I want to collect different data metrics from several different pages in the seosite.com, so the naming structure will change. What remains relatively the same is the relevant position of the target UI element on the page.

Can you suggest a scalable solution to help me reliably target the correct data on each page?

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

    If you need to pass variable values to your selectors, try reading this article on modifying selectors: https://learn.microsoft.com/en-us/power-automate/desktop-flows/build-custom-selectors

    Also watch this video: https://youtu.be/2PcyBa22Jj8

     

    Alternatively, you could try using Get details of web page to get the entire page source as an HTML text and then use Parse text with regular expressions to get the data you need. See this video on regex in PAD: https://www.youtube.com/watch?v=5cPMEBH5tj8

    -------------------------------------------------------------------------

    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.

     

  • LMOSSVA Profile Picture
    2 on at

    I am new to Power Automate Desktop and trying to determine whether I can use it to enter data into a webform from an Excel spreadsheet.  The use case is that I am trying to automate the entry of an invoice into a web based point of sale product.  To add a line item to the invoice, I must paste a barcode number from the Excel spreadsheet into a field on one form and if it is found, I must click on a "suggestion" that pops up to get to the form where I enter the rest of the information on the item then save it.   I can get Power Automate to do almost all of this except click on the "suggestion" link that pops up. 

     

     When I run the capture on the manual process, the U/I element preview is  "div[Id="suggestion-box"] > ul > li > a > span[Text="L&M RED BOX 100"]" (this is a pack of cigarettes).  In this forum it is suggested that I could be less specific so that I won't need to provide the text of the suggestion name, but don't I still have to indicate that this is a "span"?  That suggestion name can have thousands of different names so it would be impossible to populate the name needed.  The good news is that there is only one link that will appear on the page if the barcode number entered on the first form is successfully retrieved.   I am new at this and don't have much development background so I am getting the feeling that I am way over my head on this one.  Screenshot of the u/i element description attached.   Any suggestions on where I can get some help on this one or should I just hire someone to do this?

     

      

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

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard