Code assets

Scriptless Web lets you run JavaScript code while the test is running in the browser's context. This article explains how to create and use a code snippet. For more information, see the Inject code tutorial.

To create a code snippet:

  1. In the Assets view, in the left pane, click Code Assets.
  2. On the right, click Add Code.
  3. In the Create a code asset form, provide the following:
    • The asset's name
    • (Optional) A description of up to 100 characters
    • Your JavaScript code
      The form includes sample code to help you get started.
  4. Click CREATE.


To use a code asset in your test:

  1. On the canvas, in Advanced mode, add a new step and select System > Run code.
  2. In the Add Flow Element form, from the Code to run (JavaScript) list, select the code asset you created.
  3. If you want to validate the result, select the Check result check box.
  4. If you want to use the result as a context variable later:
    1.  Select the Push value to context check box. 
    2. Select a value from theTransformationlist. For more information, see context variables.
  5. Click ADD.

To edit a code snippet:

  1. Hover over a code and click Edit .

  2. In the Update a code asset form, provide the following:
    • The asset's name
    • (Optional) A description of up to 100 characters
    • Your JavaScript code
      The form includes sample code to help you get started.
  3. Click UPDATE.

To delete a code snippet:

  • Hover over a code and click Delete .