Skip to content

Execute Javascript Method: RUNJAVASCRIPT

The Execute JavaScript Method action allows you to run a pre-defined JavaScript method within your automation workflow. This function is useful for executing custom JavaScript logic, interacting with web elements, or performing advanced calculations that JavaScript handles efficiently.

If the JavaScript method returns a value, the result can be assigned to a variable by specifying it in the Element Key field. 

Defining a JavaScript Method: Before using this action, ensure that the required JavaScript script is already created. Follow these steps to define and use your JavaScript method:

  • Open the Automation you want to work on.
  • Click Data as shown:

v7_huloop_actions_runjavascript_menu

  • Select Manage Javascripts:

v7_huloop_actions_runjavascript_select_menu

  • On the Manage Javascripts page, assign a Name, keep the Environment Name as default, and include the JavaScript code as shown:
Manage Javascripts page
Manage Javascripts page
  • Click Save.

All existing scripts appear on the right side of the Manage JavaScripts window, where you can edit or delete them by clicking the respective icons.

Example: Let’s execute the substring function from a pre-loaded JavaScript file called SubstringScript2 with arguments 15 and 20.

Steps to configure:

  1. Select RUNJAVSCRIPT from the Action drop-down.
  2. Leave the Screen Name field blank, as this action works directly with the JavaScript function.
  3. In the Element Key field, specify a variable name to store the output (if the function returns a value).
  4. In the Parameters section, enter: jsname=SubstringScript2,function=substring,args=15,20

(here, jsname: Name of the pre-loaded JavaScript file, function: The function to execute within the JavaScript file, and args: Comma-separated list of arguments for the JavaScript function (if applicable)).

  1. Click Save.
Note: While the steps for adding an Action are identical in both views, the display of steps varies slightly.
v7_huloop_actions_runjavascript_list_view
List View
v7_huloop_actions_runjavascript_grid_view
Grid View

Expected Outcome on Execution:

  • The Execute Javascript Method action will execute the substring function from the SubstringScript2 JavaScript file using the arguments 15 and 20.
  • If the function returns a value, it will be stored in the specified variable using the syntax ${Variable Name}.

Last updated: Oct 9, 2025
Back To Top