web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard