Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 3bw5HIyU+7sp+9CKVOQ6lL
Power Automate - Power Automate Desktop
Unanswered

Find relative web element

Like (0) ShareShare
ReportReport
Posted on 3 May 2021 11:36:46 by 4

Hi,

 

I'm trying to solve RPA challenge from this website https://futureofworkblog.web.app/challenge2021.html on a regular level. I'm trying to get an input element relative to the label class element. In UiPath there is something called Anchor activity that allows interaction with an element relative to another. Is there anything like that available in PAD? 

 

Or is there a way to create a selector that will get one element before? I was able to create selectors that get one element after, but before (previous) wasn't working. 

 

Thank you in advance.

 

  • Suggested answer
    BoredFish Profile Picture
    25 on 07 Apr 2025 at 19:19:31
    Find relative web element
    You shouldn't need to do any looping. Try directly picking the element where the next sibling has what you're looking for.
     
    Something like this:
    input:has(+ label[text="whateverXYZ"])
  • fraenK Profile Picture
    2,125 on 06 May 2021 at 09:31:46
    Re: Find relative web element

    There is no previous element selector in CSS so you'll need to (loop through the input fields) and verify their label before entering anything

  • KrzysztofKa Profile Picture
    4 on 06 May 2021 at 08:59:00
    Re: Find relative web element

    Actually, there is nothing custom to it. I just look for the .label after the input, read its content and then look for input. 

     

    #form_container > input:eq(%LoopIndex%) + .label

     

    #form_container > input:eq(%LoopIndex%)

     

    https://www.youtube.com/watch?v=mD5u8D1Fado

  • fraenK Profile Picture
    2,125 on 06 May 2021 at 08:53:31
    Re: Find relative web element

    Please post your custom selector

  • KrzysztofKa Profile Picture
    4 on 06 May 2021 at 08:26:45
    Re: Find relative web element

    I did, but it gets only UI elements after not an element before. I did it some other way, but still being able to capture elements before would a better option.

  • fraenK Profile Picture
    2,125 on 06 May 2021 at 07:47:34
    Re: Find relative web element

    Did you try this as a custom selector? https://css-tricks.com/child-and-sibling-selectors/#adjacent-sibling-combinator

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,653 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard
Loading started