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 / Difference between CSS...
Power Automate
Unanswered

Difference between CSS selectors preview and extracted data

(0) ShareShare
ReportReport
Posted on by 2

Hello guys,

I got to know PAD recently and started doing some tutorials, while applying to a real case scenario.

 

The data I'm trying to retrieve are some <li> items within a <ul> with a specific class.

Using live helper I selected the items I need, while also filtering them for specific text.

 

In the preview the data shows fine, all nicely distributed to the desired columns, but when the flow ends, the datatable/Excel written extracts the all text after the string, not as in the preview. Please see photos attached (it should have stopped at the red line).

It seems that a new line feed is added to each <li> item, but somehow the preview doesn't match with the final result.

 

These are two regex I tried to use:

(?<=Modelo: ).+

(?<=Modelo: )(.*?)(?=[\n\r])

 

Any ideas?

Thanks in advance

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

    Can you share what the web page looks like, with the specific values inspected via the browser developer tools?

    Also, can you share a screenshot of your flow? Do you extract the data directly to Excel, or do you do any processing after the extraction?

     

  • some1 Profile Picture
    2 on at

    Sure, here is the code:

    <ul class="css-sfcl1s">
     <li class="css-1r0si1e">
     <p class="css-b5m1rv er34gjf0"><span>Particular</span></p>
     </li>
     <li class="css-1r0si1e">
     <p class="css-b5m1rv er34gjf0">Modelo: Passat</p>
     </li>
     <li class="css-1r0si1e">
     <p class="css-b5m1rv er34gjf0">Mês de Registo: Novembro</p>
     </li>
     <li class="css-1r0si1e">
     <p class="css-b5m1rv er34gjf0">Ano: 2001 </p>
     </li>
     <li class="css-1r0si1e">
     <p class="css-b5m1rv er34gjf0">Cilindrada: 1.900 </p>
     </li>
     <li class="css-1r0si1e">
     <p class="css-b5m1rv er34gjf0">Combustível: Diesel</p>
     </li>
     <li class="css-1r0si1e">
     <p class="css-b5m1rv er34gjf0">Potência: 130 </p>
     </li>
     <li class="css-1r0si1e">
     <p class="css-b5m1rv er34gjf0">Tipo de Caixa: Manual</p>
     </li>
     <li class="css-1r0si1e">
     <p class="css-b5m1rv er34gjf0">Condição: Usado</p>
     </li>
     <li class="css-1r0si1e">
     <p class="css-b5m1rv er34gjf0">Portas: 4-5</p>
     </li>
     <li class="css-1r0si1e">
     <p class="css-b5m1rv er34gjf0">Lugares: 5</p>
     </li>
     <li class="css-1r0si1e">
     <p class="css-b5m1rv er34gjf0">Origem: Nacional</p>
     </li>
    </ul>

     

    My flow contains two extract data from web page because, if the ad has no photo, the <ul> element is inside the div (0). If it has a photo, it's inside div (1). In case of a missing div, the flow tries to get the next one. There's probably a more elegant way to do this but it now works.

     

     

    regex.jpg
    flow.jpg
  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    That is an interesting approach to do this. I've never seen it done like this, where you pull the entire list to each value, but use regex to reduce it to a single value. 

     

    It would likely work better if you provided the specic <li> to the CSS selectors in Extract text from web page, but I assume the reason why you did not do that was because the order of those items can be different.

     

    I would thus suggest doing this slightly differently. Use Get details of web page to get the entire page source. Then use Parse text with regular expressions enabled, to pull out the data you need. You will be able to use the same regex, but will need a positive lookbehind of </p> to not include those irrelevant HTML tags. So, for example:

    (?<=Modelo: ).*?(?=</p>)

     

    This will require more actions than your current flow:

    • One Get details of web page action instead of two Extract data from web page
    • Six Parse text actions
    • Six Write to Excel worksheet actions, as you will need to write those values one by one.

    But at least this will work properly.

     

    To answer your question - I am not sure why it works like this, but it seems to be because you're pulling out the entirety of the list, and not a single item. 

    -------------------------------------------------------------------------
    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.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 921

#2
Valantis Profile Picture

Valantis 801

#3
Haque Profile Picture

Haque 588

Last 30 days Overall leaderboard