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 / Xpath in web elements ...
Power Automate
Unanswered

Xpath in web elements in power automate desktop

(0) ShareShare
ReportReport
Posted on 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'].

I have the same question (0)
  • tkuehara Profile Picture
    667 on at

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

  • Rkv_ Profile Picture
    166 on at

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

  • Shan24 Profile Picture
    4 on at

    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

  • Prit Profile Picture
    5 on at

    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 at

    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.

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    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.

  • gauravsolanke Profile Picture
    52 on at

    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 ?

  • cwischnewski Profile Picture
    160 on at

    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.

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 605

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard