> For the complete documentation index, see [llms.txt](https://help.autify.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.autify.com/nocode-mobile/en/using-autify-nocode-mobile/scenario-creation-and-maintenance/javascript-step.md). Agents can also search and read this documentation through its [MCP server](https://help.autify.com/~gitbook/mcp).

# JavaScript Step

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

{% hint style="info" %}
JavaScript Steps are currently available as a public beta feature. For more information on our public beta features, refer to [this page.](https://help.autify.com/nocode-mobile/en/faq/other-faq/what-is-public-beta.md)
{% endhint %}

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

   ![](https://1041389054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fj0BSsfTevAGpY0hwBHT7%2Fuploads%2Fgit-blob-dfdfdd08797ef6414979f756eea51c3e08cfb0ef%2F%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88%202025-09-01%2022.34.36.png?alt=media)
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.

   ![](https://1041389054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fj0BSsfTevAGpY0hwBHT7%2Fuploads%2Fgit-blob-fdb19bc7e326132abee0470ddb3598f550234125%2F%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88%202025-09-01%2022.37.42.png?alt=media)
5. (Optional) Give the step a name and add a memo to describe its purpose.

   ![](https://1041389054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fj0BSsfTevAGpY0hwBHT7%2Fuploads%2Fgit-blob-43507e267cf9db3295504c619395eb95cff203c3%2F%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88%202025-09-01%2022.37.53.png?alt=media)
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.

   ![](https://1041389054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fj0BSsfTevAGpY0hwBHT7%2Fuploads%2Fgit-blob-55f2ea44395d0f7bfd5be2d42107e15f87fa328b%2F%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88%202025-09-02%207.28.40.png?alt=media)
3. When you run the scenario, you can verify the actual returned value in the test results.

   ![](https://1041389054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fj0BSsfTevAGpY0hwBHT7%2Fuploads%2Fgit-blob-c0f221953f5cf5ed27731ce4b2df7dda489cc109%2F%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88%202025-09-02%207.34.12.png?alt=media)

{% hint style="warning" %}

* 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.
  {% endhint %}

## Functions available in JavaScript Steps

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

<table data-search="false"><thead><tr><th>Title</th><th>Platform</th><th>Reference</th><th>Remarks</th></tr></thead><tbody><tr><td>autify.mobile.getDriver</td><td>Android, iOS</td><td>Non standard API</td><td>Retrieves an Appium driver instance</td></tr><tr><td>driver.executeScript</td><td>Android, iOS</td><td><a href="https://webdriver.io/docs/api/webdriver/#executescript">https://webdriver.io/docs/api/webdriver/#executescript</a></td><td></td></tr><tr><td>driver.findElement</td><td>Android, iOS</td><td><a href="https://webdriver.io/docs/api/webdriver/#findelement">https://webdriver.io/docs/api/webdriver/#findelement</a></td><td></td></tr><tr><td>driver.findElements</td><td>Android, iOS</td><td><a href="https://webdriver.io/docs/api/webdriver/#findelements">https://webdriver.io/docs/api/webdriver/#findelements</a></td><td></td></tr><tr><td>element.click</td><td>Android, iOS</td><td><a href="https://webdriver.io/docs/api/element/click">https://webdriver.io/docs/api/element/click</a></td><td></td></tr><tr><td>element.getAttribute</td><td>Android, iOS</td><td><a href="https://webdriver.io/docs/api/element/getAttribute">https://webdriver.io/docs/api/element/getAttribute</a></td><td></td></tr><tr><td>element.getLocation</td><td>Android, iOS</td><td><a href="https://webdriver.io/docs/api/element/getLocation">https://webdriver.io/docs/api/element/getLocation</a></td><td></td></tr><tr><td>element.getTagName</td><td>Android, iOS</td><td><a href="https://webdriver.io/docs/api/element/getTagName">https://webdriver.io/docs/api/element/getTagName</a></td><td></td></tr><tr><td>element.getText</td><td>Android, iOS</td><td><a href="https://webdriver.io/docs/api/element/getText">https://webdriver.io/docs/api/element/getText</a></td><td></td></tr><tr><td>element.getValue</td><td>Android, iOS</td><td><a href="https://webdriver.io/docs/api/element/getValue">https://webdriver.io/docs/api/element/getValue</a></td><td></td></tr><tr><td>element.isDisplayed</td><td>Android, iOS</td><td><a href="https://webdriver.io/docs/api/element/isDisplayed">https://webdriver.io/docs/api/element/isDisplayed</a></td><td></td></tr><tr><td>element.setValue</td><td>Android, iOS</td><td><a href="https://webdriver.io/docs/api/element/setValue">https://webdriver.io/docs/api/element/setValue</a></td><td></td></tr><tr><td>element.longPress</td><td>Android, iOS</td><td><a href="https://webdriver.io/docs/api/mobile/longPress">https://webdriver.io/docs/api/mobile/longPress</a></td><td></td></tr><tr><td>fetch</td><td>Android, iOS</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API">https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API</a></td><td>Not fully compatible with the standard fetch</td></tr><tr><td>sleep</td><td>Android, iOS</td><td>Non standard API</td><td></td></tr></tbody></table>

## 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](https://javascript-snippets.autify.com/)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.autify.com/nocode-mobile/en/using-autify-nocode-mobile/scenario-creation-and-maintenance/javascript-step.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
