RunJavascript

RunJavascript command is used to execute a javascript method.

Javascript method is defined in Data > Manage JavaScripts as shown below:

Give name, function name and javascript function in the specified area. Name and function name will be used in the test step to call this javascript function.

Select RUNJAVASCRIPT command from the action drop down, leave Screen name blank, Give variable name in the Element key where output of the javascript function will be stored (if that function returns any value) and provide javascript function in parameter section as shown below:

Syntax: jsname=SubstringMethod,function=substring

You can also parameterise the arguments (if any) of javascript function from the test step itself. In that case syntax will be as shown below:

Example: jsname=SubstringScript2,function=substring,args=15,20

After completing this step, test step will look as below:

Was this page helpful?