Critical Developers

Programmers Knowledge Base

Execute jQuery in Automation Anywhere

Many of us wondering how can we use jQuery for DOM manipulations and other functions/utility in Automation Anywhere, as if in AA there is "Execute Javascript Function" and "Run Script" Command. So friends, after thinking alot I wrote a bot which will allow to execute your jQuery function for DOM manipulations and everything about jQuery.

The bot can do--

  • This bot will load jQuery library and then execute your custom jQuery code using "Execute Javascript Function" command.
  • It can execute jQuery functions for DOM manipulations.
  • Will teach you how to execute jQuery in Automation Anywhere.
  • You can perform left-click, right-click, can also fill the entire form, etc. using JQuery and can automate many events using jQuery.
  • Rest you know the capabilities of jQuery...  

Logic behind jQuery bot--

1) Create a metabot which will accept jQuery file path and read entire jQuery definition and assign it to a variable, let say vJQueryDefinition

Note - it is only one time operation after that you can use it anywhere in your taskbot.

2) Take another variable "vMyJQueryCode" in which we will call jQuery functions. 

e.g.: $(document).ready(fuction(){ // your jQuery code will come here });

3) Finally drag & drop "Execute Javascript Function" command in workbench and pass JS function parameter like 

"vJQueryDefinition vMyJQueryCode"

So now, you can see jQuery definition will load first and then your custom jQuery function will get execute.

4) Run task

Bot is available at botstore, the link to download the bot is -

Note - You can replace jQuery file/version with the latest one if required.

Another approach is, you can use "Rest Web Service" command and using GET verb call jQuery CDN to load the jQuery definition in a variable.

But there is some disadvantage like - 

GET request is bit slow

Depends on internet connectivity so you will have to handle that in case request timed out.

Hope this article helped you !!!

Comments are closed