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 / Loop Browser Element b...
Power Automate
Suggested Answer

Loop Browser Element based on it's Attribute

(1) ShareShare
ReportReport
Posted on by 26
Can you please advise how would you do a loop that goes through each tbody element and checks if class attribute IS NOT equal to "day dayOff"?
 
Exampletbody > class[NOT EQUAL "day dayOff"]
 
3.png
I have the same question (0)
  • Suggested answer
    Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at
    Hi, 
     
    One logic i could think of is - you can use following selector in format 
     
    tbody[class!="day dayOff"]
     
    Now the logic on how to achieve this kind of looping UI Elements would be like as below
     
    1. Use Javascript function on webpage to count the number of elements equal to xpath //tbody[@class!="day dayOff"] using belos function code.
    function ExecuteScript() { 
    var xpathResult = document.evaluate('//tbody[@class!="day dayOff"]', document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
      
      // Return the number of elements found
      return xpathResult.snapshotLength;
    
    
    }
    like below
     
    the output of this function would be number of ui elements whose selectors would have tbody with class attribute not equal to day dayOff.
     
    Now loop through the result variable after converting to a number format using convert text to number action and then using loop action as shown below
     
    I am not sure what you are trying to do with each UI Elements having tbody tag containing class attribute not equal to day dayOff.- but here i have used a click action which will click on each ui element having selector as 
     
    tbody[class!="day dayOff"]:eq(%LoopIndex%)
     
     
     
    Hope this idea helps !
    Thanks & Regards,
    Nived N 
    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel
    Blog: Nived Nambiar's Blogs
     Found my answer helpful? Please consider marking it as the solution!
     Your appreciation keeps me motivated. Thank you!

     

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 427

#2
Vish WR Profile Picture

Vish WR 316

#3
David_MA Profile Picture

David_MA 260 Super User 2026 Season 1

Last 30 days Overall leaderboard