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 / Custom Selector for we...
Power Automate
Answered

Custom Selector for web element based on the property of a sibling element

(0) ShareShare
ReportReport
Posted on by 18

I have a webpage with a list of elements. I want to select a button side of the div that is listed down the page, where the parent div contains an element with a specific value.

For example in the screenshot below, I'm looking for the Edit button, that shares a parent with an element with the title "Research Seminar". 

The position in the list can vary a lot, so indexes are not going to work I think. Any ideas?  

Peter38_0-1716440728267.png

 

I have the same question (0)
  • Verified answer
    Peter38 Profile Picture
    18 on at

    Ok, I've worked it out. The trick was to use ":has() 

    First I got the selectors for the 3 elements I was looking at 

     

    div[Id="AgreementReviewListSection_RDP_ThumbnailViewer_CARD"] > div > div > div > div[Class="itemWrapper clearFix"] //the shared parent
    div[Id="AgreementReviewListSection_RDP_ThumbnailViewer_CARD"] > div > div > div > div > div > div > div > ul > li > button[Title="Edit"]:eq(2)//the title (condition)
    div[Id="AgreementReviewListSection_RDP_ThumbnailViewer_CARD"] > div > div > div > div > div > div > div > div[Title="Research Proposal"] > span[Text="Research Proposal"] //the button (goal)

     

     and combined them to look for the button, under the parent that has the selector

     

    div[Id="AgreementReviewListSection_RDP_ThumbnailViewer_CARD"] > div > div > div > div[Class="itemWrapper clearFix"]:has([Title="Research Proposal"]) > div > div > div > ul > li > button[Title="Edit"]:eq(2)

     

     

    I'm still pretty new at this, so any feedback on how this could be done easier, or cleaner would be appreciated

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 474

#2
11manish Profile Picture

11manish 268

#3
David_MA Profile Picture

David_MA 243 Super User 2026 Season 1

Last 30 days Overall leaderboard