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:
- Click the Menu
available on the top right of the screen.
- Expand the Data option and select Manage Javascripts:

- Assign a Name, keep the Environment Name as default, and include the JavaScript code as shown:
- 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:
- Select Execute Javascript Method from the Action drop-down.
- Leave the Screen Name field blank, as this action works directly with the JavaScript function.
- In the Element Key field, specify a variable name to store the output (if the function returns a value).
- 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)).
- Click Save.
Note: While the steps for adding an Action are identical in both views, the display of steps varies slightly.


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}.