Skip to main content

Notifications

Community site session details

Community site session details

Session Id : BH8ObK6/ZEyYoSJ7zMkYGz
Power Automate - Power Automate Desktop
Unanswered

Xpath in web elements in power automate desktop

Like (0) ShareShare
ReportReport
Posted on 6 Jul 2021 05:05:53 by 58

Can we use Xpath (not CSS selector) for identifying web elements in power automate desktop. Ex -  If I have to locate a element with xpath like - //div[text() = 'Test'].

  • cwischnewski Profile Picture
    118 on 05 Apr 2024 at 12:23:57
    Re: Xpath in web elements in power automate desktop

    I have two sources I regularly use.

     

    First, this cheatsheet helps connect XPath concepts to CSS selector concepts: https://devhints.io/xpath

     

    Second, the jQuery selector documentation helps with finding things like those contains and has functions: https://api.jquery.com/category/selectors/.  Good luck.

  • gauravsolanke Profile Picture
    52 on 05 Apr 2024 at 11:12:45
    Re: Xpath in web elements in power automate desktop

    div[Id="__next"] > div > main > div > section > div > div > button  
    this is the default selector code in my PDA to click on buuton 
    can you please suggest the relative code those should not to maintain everytime as div struture can be change anytime in DOM ?

  • Agnius Bartninkas Profile Picture
    10,045 Most Valuable Professional on 09 Nov 2023 at 08:19:00
    Re: Xpath in web elements in power automate desktop

    As a previous response has already confirmed, XPath cannot be used on web elements in PAD. We can only use HTML/CSS for selectors selectors. The only way to really use XPath on a web page is by using Run JavaScript function on web page and targeting the elements via XPath to an extent to which JS supports it.

  • Prit Profile Picture
    5 on 09 Nov 2023 at 07:58:57
    Re: Xpath in web elements in power automate desktop

    Hello, were you able to find a solution to this? how to write the syntax for all the X-path axes like ancestor, descendant, following, following-sibling, parent, preceding, preceding-sibling for spying on the Web UI elements in Power Automate Desktop.

  • Prit Profile Picture
    5 on 09 Nov 2023 at 07:58:22
    Re: Xpath in web elements in power automate desktop

    Hello, were you able to find a solution to this? how to write the syntax for all the X-path axes like ancestor, descendant, following, following-sibling, parent, preceding, preceding-sibling for spying on the Web UI elements in Power Automate Desktop.

  • Shan24 Profile Picture
    4 on 16 Feb 2023 at 10:16:47
    Re: Xpath in web elements in power automate desktop

    Hello @tkuehara 

    Thanks for the above insight above xpath in identifying the descendant element in PAD,
    Also, can you provide any source or material on how to write the syntax for all the Xpath Axes like ancestor, descendant, following, following-sibling,parent, preceding, preceding-sibling. This would be really helpful in spying on the Web UI elements in PAD.
    I am awaiting your answer.

    Thanks in Advance

  • Rkv_ Profile Picture
    166 on 08 Jul 2021 at 10:11:07
    Re: Xpath in web elements in power automate desktop

    @mayankgoyal We cannot use XPath for identifying Web Elements in PAD.

  • tkuehara Profile Picture
    667 on 06 Jul 2021 at 12:15:28
    Re: Xpath in web elements in power automate desktop

    Hi @mayankgoyal 

     

    As far as I know you can only use xpath to query xml documents. However you can use jQuery to help you select web elements which is very powerful. Example:

    Look for a div element that contains a given 'Text' -> div:contains(Text)

    Look for a div element that has any p descendant which contains 'Text' in it -> div:has(p:contains(Text))

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,780 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,093 Most Valuable Professional

Leaderboard