Tap On View

Taps on a view on the screen:
- tapOn:
text: "Text" # (optional) Finds text that matches regexp
id: "id" # (optional) Finds id that matches regexp
index: 0 # (optional) 0-based index of the view to select among those that match all other criteria
width: 100 # (optional) Finds element of a given width
height: 100 # (optional) Finds element of a given height
tolerance: 10 # (optional) Tolerance to apply when comparing width and height
enabled: true # (optional) Searches for view with a given "enabled" state
optional: false # (default: false) If set to true, test won't fail if view can't be found

Relative Position

Maestro is also able to select views using their relative position (i.e. "below another view", or "contains child")
- tapOn:
below: "View above that has this text" # This will match view *above* that has the given text
id: "view_below_id" # This will match a view *below* that has the given id
leftOf: "View to the right has this text"
rightOf: "View to the left has this text"
containsChild: "Text in a child view" # This will match a view that has a *direct* child view with the given text

Tapping on a specific point on the screen

You can also specify absolute coordinates on the screen to tap on:
- tapOn:
point: 100,200 # This command will tap on point x:100 y:200 on the screen (in pixels)

Long press

To long press on a view or a point, use the same exact properties but with a longPressOn command
- longPressOn: Text
- longPressOn:
id: view_id
- longPressOn:
point: 100,200

Selecting one view among many similar

If you have multiple views matching the same selector (i.e. many views with text Hello), use index parameter to specify which one to select exactly. For example, the following command will pick the 3rd view that has text Hello:
- tapOn:
text: Hello
index: 2


appId: com.android.contacts
- launchApp
- tapOn:
id: .*floating_action_button.* #regex
- inputText: "John"
- tapOn: "Last Name"
- inputText: "Snow"
- tapOn: .*Save.*