What is JS Step?
  • 10 Jun 2022
  • 2 Minutes to read
  • Contributors
  • Dark
    Light

What is JS Step?

  • Dark
    Light

[JS Step] is a function that allows you to write JavaScript within Autify’s [Scenario].
This function opens up various functions that are not possible with Autify’s standard functions.

You can see snippets here for frequently used cases.

This is a powerful feature so we have provided a detailed explanation below.
After the section on how to use this function, there are specific use cases in the latter part of this article. We hope they are useful!

Add a [JS Step] to a [Scenario]

  1. Open the Scenario Details Page.

  2. Move the mouse cursor between the steps where you want to add a [JS Step].

  3. Click the + icon and select Insert [JS Step] from the menu.

  4. Enter the JavaScript code.

  5. Click Save.

Notes for use

  • Hard tabs cannot be used. Please use space instead.
  • If you plan to run it in the IE environment, please use / * comment * / for any comments. If you use // comment for comments, it will fail in IE.
    (There will be no problems in environments other than IE.)

Use a value obtained or generated in [JS Step] in other steps

In [JS Step], you can obtain information from elements displayed on the page or generate values. return allows you to use this information in subsequent steps.

Only strings and numbers can be used in subsequent steps.

  1. return the values within [JS Step]
  2. Select Other step's result in the Text to assign section in another step (the step must be after the [JS Step]).

This is supported in most operation steps and Assertion steps that use strings.
The main steps are the following:

  • Operation step

  • Input step

  • URL transition step

  • Assertion step

  • Assertion for the page title

  • Assertion for the page URL

  • All text on the page

Using the [Argument function]

The value returned from [Data] and other [JS Steps] can be used within a [JS Step] by assigning it as an argument.

  1. In the Scenario Details Page, click the thumbnail of the [JS Step] to which you want to add an argument. The step details will open.

  2. Click the + icon next to function.

  3. Enter the argument name and click _Add.
    _

  4. [Argument values] pane is displayed after you add an argument, on the right side of the step details.

  5. Given value allows you to directly enter a string.
    [Data] allows you to use the column in the scenario.
    Other step’s result allows you to use the value returned in a preceding [JS Step].
    The screenshot below shows what it looks like if you select [Data].

  6. If you want to delete or rename a variable that has already been added, click the target variable.


First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.