Showing results for 
Search instead for 
Did you mean: 
Advocate I
Advocate I

click web elements with xpath or css selector


I have been trying to use the javascript for web functions function for clicking web elements. For our current project we are unable to get some of the web elements we need using the web recorder. The elements can only be selected using the move to image and I prefer not to do that.


So we were thinking that it could be possible to select and click these using javascript.  


I used :



document.evaluate("<xpath>", document, null, XPathResult.ANY_TYPE, null).click();


I have tried a variety of selectors created and tested with selenium ide and the chrome inspector.

Does anyone how to do this using javascript? or with something else?. 


Thank you


Advocate III
Advocate III

Clicking via JS using the .click() method is not accepted by all web pages. Depends on how the web page itself is built. But in a lot of cases, you need to work in the user context in order for the click event to actually bring up the expected result and that is not the way the JS functionality in PAD works.


However, if you could provide some more details on what it is exactly that you are trying to click and which web page that element is on, it may be a bit easier to come back with a more detailed suggestion on what's the best way to go about it.

Helpful resources

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Users online (2,535)