tapOn
In order to tap on a view with the text "My text" you can use the shorthand selector for text like this:
You can also use other selectors such as id:
For a full list of selectors, please refer to the Selectors page.
Repeat taps
In some cases it is desirable to repeat taps. To achieve that, the following is possible:
retryTapIfNoChange
Sometimes, tapOn will try to tap again if it doesn't detect a hierarchy change. To fix such cases, use retryTapIfNoChange. For example:
In this example, the tapOn will never try to tap again.
Control wait time
Maestro usually waits for the screen to settle before moving to the next command, however that is not always desirable.
If your app or screen has the following:
Moving elements like a countdown timer
Non-blocking animations that are part of the UI
Then, you can use waitToSettleTimeoutMs
to limit the time Maestro waits for things to settle
Note: This will be a best effort timeout. Maestro will not interrupt core operations to honor the timeout.
Tapping on a specific point on the screen
Whenever possible, prefer tapping on view id or text instead of coordinates as this might make your tests dependent on a specific type of a device
You can specify a relative position on the screen using:
You can also specify absolute coordinates on the screen to tap on:
Tapping on a specific point within another element
If you wish to tap on a point on screen inside another element you can do the following:
This will find an element with text "A text with a hyperlink" and tapOn towards the end of the sentence where "hyperlink" is located.
Long press
To long press on a view or a point, use the same exact properties but with a longPressOn
command:
Long press on a specific point within another element
If you wish to long press on a point on screen inside another element you can do the following:
This will find an element with text "A text with a hyperlink" and longPressOn towards the end of the sentence where "hyperlink" is located.
Example
Last updated