JavaScript Step

Prev Next

What is a JavaScript Step?

A JavaScript Step is a feature that allows you to use custom JavaScript in a test scenario to perform operations and assertions not supported by Autify's standard functionality. For instance, you can use it for cases like:

  • Generating dynamic dates or usernames for use in later steps.
  • Retrieving one-time passcodes from emails to be entered in a subsequent step.
  • Verifying the attribute values of an element.

Additionally, you can use the autify.mobile.getDriver method to access and utilize the Appium library.

JavaScript Steps are currently available as a public beta feature.
For more information on our public beta features, refer to this page.

Adding a JavaScript Step to a scenario

  1. Open the Scenario Details screen.
  2. Move your cursor between the steps where you want to insert the JavaScript step.
  3. Click the + button and select "Insert JavaScript Step" from the menu that appears.
    スクリーンショット 2025-09-01 22.34.36.png
  4. Enter your JavaScript code in the text editor. The code is wrapped in a function, so you don't need to add the function syntax yourself.
    スクリーンショット 2025-09-01 22.37.42.png
  5. (Optional) Give the step a name and add a memo to describe its purpose.
    スクリーンショット 2025-09-01 22.37.53.png
  6. Click "Save" to save the scenario.

Using values obtained or generated from a JavaScript Step in an Input Step

You can use values obtained or generated within a JavaScript Step in subsequent input steps by using a return statement.

  1. In the Scenario Details screen, click on the step where you want to use the returned value.
  2. From the input value's dropdown menu, select "Get from another step" and then choose a JavaScript Step with a return value.
    スクリーンショット 2025-09-02 7.28.40.png
  3. When you run the scenario, you can verify the actual returned value in the test results.
    スクリーンショット 2025-09-02 7.34.12.png
  • After creating a JavaScript Step, you must save it at least once before its value becomes available for use in subsequent steps.
  • If you do not explicitly return a value within the JavaScript Step, its default return value will be null.

Functions available in JavaScript Steps

Currently, the functions supported in NoCode Mobile are limited. Please check the following list for the available functions.

Title Platform Reference Remarks
autify.mobile.getDriver Android, iOS Non standard API Retrieves an Appium driver instance
driver.executeScript Android, iOS https://webdriver.io/docs/api/webdriver/#executescript
driver.findElement Android, iOS https://webdriver.io/docs/api/webdriver/#findelement
driver.findElements Android, iOS https://webdriver.io/docs/api/webdriver/#findelements
element.click Android, iOS https://webdriver.io/docs/api/element/click
element.getAttribute Android, iOS https://webdriver.io/docs/api/element/getAttribute
element.getLocation Android, iOS https://webdriver.io/docs/api/element/getLocation
element.getTagName Android, iOS https://webdriver.io/docs/api/element/getTagName
element.getText Android, iOS https://webdriver.io/docs/api/element/getText
element.getValue Android, iOS https://webdriver.io/docs/api/element/getValue
element.isDisplayed Android, iOS https://webdriver.io/docs/api/element/isDisplayed
element.setValue Android, iOS https://webdriver.io/docs/api/element/setValue
fetch Android, iOS https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API Not fully compatible with the standard fetch
sleep Android, iOS Non standard API

Points to note

  • When verifying and implementing JavaScript Steps, it may sometimes be necessary to check the actual application's code. Please either set up your own development environment or work with your developers to implement the code.
  • Please be aware that this feature is designed for customer-side development. Therefore, our Customer Support team is unable to create code on your behalf. We appreciate your understanding.

FAQ

  • Can I use it a return value from a JavaScript Step with an Assertion Step?
    • No, you cannot currently use a value from a JavaScript step in an Assertion step.
  • Can I use arguments?
    • No, you cannot currently use arguments in a JavaScript step.
  • Can I save frequently used operations as a snippet?
    • No, saving snippets is not currently supported.
  • Are JavaScript snippets publicly available, like for NoCode Web?
    • We do not provide snippets specifically for NoCode Mobile, but some of the snippets for NoCode Web are also compatible.
    • Autify JavaScript Snippets