> 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/troubleshooting/tips/tips-to-stabilize-element-selection-image-recognition.md). Agents can also search and read this documentation through its [MCP server](https://help.autify.com/~gitbook/mcp).

# Tips for selecting elements reliably (Image Recognition)

When Autify searches for an element using image recognition, it locates the element based on the appearance of the area that you selected during recording.

Please keep the following points in mind so that Autify can select elements reliably.

## Select a distinctive area for the element

Reliability may be affected if the area you select has nothing displayed around it, or if there are multiple areas that have the same appearance. You can make tests more reliable by interacting with areas that have an appearance that's distinctive to the target element.

As you can see in the example image below, it's best to tap an area that has distinguishing characteristics and avoid white areas.

![](https://1041389054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fj0BSsfTevAGpY0hwBHT7%2Fuploads%2Fgit-blob-547401078674ee078cb816e10f2aa170d17193ba%2Fgood%20bad%20selection%201.png?alt=media)

## Avoid areas where the appearance changes frequently

Reliability may be affected if there are elements close-by whose appearance changes at each test run, such as time, date, or dynamic content. Whenever possible, choose an area within the target element where the appearance remains consistent.

## (Advanced) Element Search Using *Detection Pattern*

By learning more about how element detection using image recognition works, you'll gain a deeper understanding of how to make tests reliable. Here, you'll learn about the *detection patterns* that the image recognition locator uses.

A *detection pattern* is a section of a screenshot that the image recognition locator uses to search for elements. The element search process is as follows.

### Tap

1. A *detection pattern* is created by cropping the tapped area from the screenshot taken during recording.
2. During test runs, Autify searches the screen for a location that matches the *detection pattern*.

The *detection pattern* is created dynamically during test runs. You can find the *detection pattern* used during testing on the Test Results page.

When interacting with an element, tapping a section with visually distinctive features improves the test's reliability. This is because the distinctive features are included in the detection pattern.

![](https://1041389054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fj0BSsfTevAGpY0hwBHT7%2Fuploads%2Fgit-blob-561666c49a050857e8521b46b93433dd8876e369%2FUntitled%20\(4\)\(2\).png?alt=media)

If the element search is unreliable because the location you want to interact with lacks a distinctive appearance, or because its appearance frequently changes, you can define the *detection pattern* manually.

To define the *detection pattern* manually, go to the Quick Element Update page and select **\[Manual]** under the **Adjust Detection pattern** section.

![](https://1041389054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fj0BSsfTevAGpY0hwBHT7%2Fuploads%2Fgit-blob-04f2cec788b39a0028a43408e268472c8ebad86f%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%202024-06-20%2011.11.29.png?alt=media)

In this case, **the location you tap can be outside the&#x20;*****detection pattern***. Even if the appearance of the tap area changes frequently, tapping outside the *detection pattern* will work as long as there's a stable element nearby.

#### 💡Tips

For example, in the image below, suppose you want to tap the 「Check Availability・Reserve」 button element. In this case, since the elements above the target may change, setting the detection pattern to include the area in the pink frame (as shown in the example below) might lead to failure. To ensure stability, it is recommended to specify a range that only includes the part of the button element where the appearance does not change (as shown in the example below: blue frame).

![](https://1041389054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fj0BSsfTevAGpY0hwBHT7%2Fuploads%2Fgit-blob-c6349959b0c80735249e3ee32bd80ed2f5a2f9b1%2FScreenshot%202026-04-21%20at%2015.19.31.png?alt=media)

### Swipe to Element

To display the detection pattern during recording, swipe to the target element and select it. Then, adjust the detection pattern to cover all of its features. During test runs, Autify will locate the matching position on the screen and swipe to that position.

For Swipe to Element, the detection pattern must be adjusted manually.

See [Swipe to Element](https://help.autify.com/nocode-mobile/en/using-autify-nocode-mobile/scenario-creation-and-maintenance/swipe-to-element.md) for more information.

### If element search remains unstable even after adjusting the detection pattern

We recommend using XPath or Accessibility ID locators if the target element's appearance changes frequently, or if the element is not reliably selected even after adjusting the *detection pattern*.

#### 💡Tips

For example, suppose the target element is 「EAST NIHONBASHI：SANDWICH」. Although the text 「EAST NIHONBASHI：SANDWICH」 remains the same, if the application applies a mechanism where the text wraps depending on the width of the device being used, the visual appearance will change. In such cases, if you are using an image recognition locator, it may result in a failure. For these scenarios, we recommend using an XPath locator.

![](https://1041389054-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fj0BSsfTevAGpY0hwBHT7%2Fuploads%2Fgit-blob-4f999ef383c4c27b1623d9827681a3bd8333dbbb%2FScreenshot%202026-04-21%20at%2015.22.12.png?alt=media)


---

# 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/troubleshooting/tips/tips-to-stabilize-element-selection-image-recognition.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.
