tapOn
Last updated
Was this helpful?
Last updated
Was this helpful?
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 page.
In some cases it is desirable to repeat taps. To achieve that, the following is possible:
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.
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.
You can specify a relative position on the screen using:
You can also specify absolute coordinates on the screen to tap on:
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.
To long press on a view or a point, use the same exact properties but with a longPressOn
command:
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.