Tap Command
What Elements Can You Reference?
Text: Use the
tapOn
command to interact with text-based elements.Element IDs:
For iOS, use the
accessibilityIdentifier
.For Android, use the
resource-id
.
Syntax
Referencing Text
To reference text within your mobile app, use the following syntax:
Example:
Referencing Element IDs
To reference element IDs, use the following syntax:
Example:
Note: Both text and element ID references are case sensitive. Quotation marks may break when copying from external sources like Google Documents. If this occurs, simply retype the quotation marks manually to ensure proper formatting.
How to Easily Access Element IDs using the UI Inspector
You can use our UI Inspector to quickly identify and reference element IDs. The inspector simplifies locating the relevant identifiers, allowing you to copy and paste them directly into your test scripts for seamless execution. Follow the steps below to use the UI Inspector:
Step 1: Activate the UI inspector tool by clicking the icon.
On the right-hand side of the interface, click on the UI Inspector icon (as shown in the image).
Step 2: Click on the element you wish to capture.
Once the UI Inspector is active, hover over the element you wish to reference in your test. The element will be highlighted (see image). Click on it to select.
Note: If the element.ID is available, GPT Driver will prioritize using it first. Only if the element.ID is not available will GPT Driver use the text attribute as a fallback.
Step 3: The element ID is automatically copied, ready to be pasted into your test script.
After selecting the element, the element ID will be automatically copied to your clipboard. When you paste the copied element ID into your test script, it will be pasted as
tapOn.id: "<element ID>".
Since tapping is the most common action in tests, this has been set as the default.
Which type of tapping execution works best?
The best execution type depends on the tests youβre running. For cross-platform tests (iOS, Android, Web), use platform-agnostic prompts by referencing text in tap commands (e.g., tapOn: ββ<text>"), as element IDs differ across platforms. If your app supports multiple languages, using element IDs for tap commands (e.g., tapOn.id: ββelement id") ensures language-agnostic steps and more consistent results.
Last updated