tapOn
Taps on an element using a selector.
Options
Tap on text
- tapOn:
text: "some text"
Tap on an element with ID
- tapOn:
id: "some-id"
Tap on a point in the top left corner of the screen
- tapOn:
point: 10%,10%
Tap on a point in the center of the screen
- tapOn:
point: 50%,50%
Repeating Taps
If you need to tap multiple times, make use of the repeat
option:
- tapOn:
id: "some-id"
repeat: 4
By default, taps will occur 100 milliseconds apart; you can change this using the delay
option:
- tapOn:
id: "some-id"
repeat: 2
delay: 300
Note: for a double tap, you may prefer the doubleTapOn command
Retry Tap If No Change
If the test runner does not detect a view change after an tapOn
command, then it will automatically tap again.
On Android, this sometimes manifests as a double tap which can cause issues in your test steps.
You can disable this behaviour by setting the retryTapIfNoChange
option to false
:
- tapOn:
id: "submit-button"
retryTapIfNoChange: false
Wait to Settle Timeout
By default, the runner will dynamically wait for any animations to finish before executing a command. This ensures that the screen is stable, and any content is loaded, before proceeding. The argument waitToSettleTimeoutMs
will force override the wait after a configured number of milliseconds.
However, in some cases, this might be undesirable behaviour such as with animation-heavy apps.
- tapOn:
id: "submit-button"
waitToSettleTimeoutMs: 500 # waits 500ms for screen to be settle before executing
Related Commands
Last updated
Was this helpful?