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 / Can we use jQuery in J...
Power Automate
Unanswered

Can we use jQuery in JavaScript action with PAD? Help needed

(0) ShareShare
ReportReport
Posted on by 4

Hello everyone, 

I'm working on an html table with links where I keep on extracting data using standard and custom PAD/jQuery selectors.
To loop through all the rows I basically extract the id of the link/anchor tag which has the row number needed. The issue is that sometimes the next row number increases or decreases to a number that doesn't make sense from a logical perspective
eg. 1,2,3,4,300,301,302,1,5,10 (Probably because the data is coming from other tables, which I can't really access) 

So I wonder if there's a way to select the closest anchor tag, or maybe the next element with an anchor tag using jQuery selectors and without using the JavaScript action. 

 

for instance, with JS code we can do something close to:
1. element.next('a')

  1. element:contains(SomeContent).next('a') 
    + whatever we wish to do with jQuery

    if we can't do it with custom selectors, would I be able to use that run JavaScript action with jQuery? 

    Any ideas?
I have the same question (0)
  • Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @JES1 

     

    I hope you can give a try with this jquery selector in PAD

     

    element:contains(text) + a

     

    For example, i have a span element with text Data and just next to it there is an anchor element (a)

    To select the a tag based on span element text , we will use this jquery selector 🙂

    span:contains("Data") + a

     

    Hope it helps 🙂

    Mark it as solution if it resolves your query 

     

     

     

  • JES1 Profile Picture
    4 on at

    Hi Nived,

    Thanks for your answer.

     

    That won't work, as I mentioned I'm working on a table and the next element won't be simply the anchor tag.Instead at a very minimum it'd be another tr > td an then any containers for the link (e.g. div > a).

    It could also start having :eq, for instance tr:eq(2) and then the rest of the tree to get to the link.

    Using jQuery methods as I mentioned before could simplify things but I can't use them with custom selectors and apparently when I use them.inside of that run Javascript action I get nothing back. 

    Even when I test queries on the browser console they run just fine but not in PAD. That's could be a syntax issue or maybe jQuery functions won't work at all.

     

    Anyway, that's why your solution won't work.

     

    Thanks again✌🏻

  • Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @JES1 

     

    could you show me the html structure screenshot, i think by looking at the structure , i can understand properly what you need 🙂

  • Pavel_NaNoi Profile Picture
    1,074 on at

    Sounds like a job for the ":has" selector I think?

    https://developer.mozilla.org/en-US/docs/Web/CSS/:has

     

  • JES1 Profile Picture
    4 on at

    Thanks, everyone!
    I guess we should make this clear to everyone that ends up seeing this post:

    jQuery doesn't come with PAD by default, what we're using is simply CSS Selectors, but apparently, it can be installed and configured as a third-party library. E.g. Download jQuery files, add them to your PAD project folder, and then use it in that run JavaScript action in PAD.

    I haven't tried that yet for the record. 

  • waynewalls Profile Picture
    74 on at

    You can also install jQuery using the PAD Run JavaScript action -- if the Content Security Policy of the page will allow it. 

     

    The first action below checks to see if jQuery is already loaded and if not loads it from the Google API repository.  The second action checks to see that jQuery was in fact loaded and returns the jQuery version.

    WebAutomation.ExecuteJavascript BrowserInstance: Browser Javascript: $'''function ExecuteScript() { 
    var padElement, padChild, padElement, padReturn;
    if (!window.hasOwnProperty(\"jQuery\"))
    	{
    		padElement = document.createElement(\"script\");
    		padElement.type = \"text/javascript\";
    		padElement.src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js\";
    		padChild = document.body.appendChild(padElement);
    		padReturn = padChild.outerHTML
    	}
    	else padReturn = (\"jQuery already available\");
    return padReturn
    }''' Result=> Result
    WebAutomation.ExecuteJavascript BrowserInstance: Browser Javascript: $'''function ExecuteScript() { 
    	var padJqVersion, padJqAvailable;
    	if (window.hasOwnProperty(\"jQuery\")) padjQAvailable = \"available\"
    	else padJqAvailable = \"not available\";
    	padJqVersion = ($().jquery);
    	return (\"jQuery version \" + padJqVersion + \" is \" + padjQAvailable)
    }''' Result=> Result2

    Both of the above assume that you have a BrowserInstance open and stored in the variable %Browser%.

     

    In my experience, jQuery will not be available until the first action completes and returns to the flow.  That's why I have showed testing jQuery in a second separate subsequent action.  If anyone knows why this happens I would be interested.  It may have something to do with the way the browser extension injects scripts into the page.

     

    I would also be interested if anyone knows how to configure jQuery as a third party library in your PAD Project Folder as @JES1 has described.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 167

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard