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 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.
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 ?
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.
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.
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.
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
@mayankgoyal We cannot use XPath for identifying Web Elements in PAD.
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))
WarrenBelz
146,780
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,093
Most Valuable Professional