> For the complete documentation index, see [llms.txt](https://docs.drizz.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.drizz.dev/commands-reference/action-commands/tap/best-practices-for-tap-command.md).

# Best Practices for Tap Command

This section defines the recommended practices for writing stable and unambiguous tap commands in Drizz. Because tapping is one of the most frequently used interactions in mobile automation, clarity and precision in describing the intended UI target are essential for consistent execution.\
These guidelines help ensure that tap commands resolve accurately across different layouts, repeated elements, dynamic screens and scenarios where text labels or icons may vary. By following these practices, authors can significantly improve reliability, reduce ambiguity, and create tests that behave deterministically across devices and OS versions.

### **Recommended Best Practices for Writing Tap Commands:**

1. **Use exact text when available**\
   Write the target clearly with precision.

   1. Example: Tap ADD

   Prefer exact matches over descriptive phrases.<br>

2. **Use positional referencing when multiple identical labels exist**

   1. Example: Tap the first "ADD"
   2. Example: Tap on "Continue" at the bottom of the page

   Always specify direction to avoid ambiguity.<br>

3. **Use contextual referencing when the same text appears across sections**

   1. Example: Tap "Apply" in coupon section
   2. Example: Tap "Edit" under Profile
   3. Example: Tap on  "Blue icon" under Profile

   Helps Drizz reliably identify the correct instance.<br>

4. **Use icon/colour references when the element has no text**

   1. Example: Tap the search icon
   2. Example: Tap ton the red button

   Use icon or colour based terms only when no text label is associated.<br>

5. **Avoid phrase-based descriptions when text labels exist**

   1. Prefer: Tap Login
   2. Not preferred: Tap the login button on the lower half of the page

6. **Always validate after a critical tap**

   Example:&#x20;

   Type username as xyz\@123\
   Type password as pass\@123\
   Tap on login CTA\
   Validate Homepage is visible <br>


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.drizz.dev/commands-reference/action-commands/tap/best-practices-for-tap-command.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
