Skip to content

How do I tap on elements in mobile apps

This example demonstrates how to perform tap action on links, buttons, check-boxes and radio buttons.

In the solution shown below, you will see that tap action is performed on the "Hamburger" icon in HICC using thetap command.

Solution:

# Command Target Value
Uninstall app by providing the app package name in target
1 tap //android.widget.ImageButton[@content-desc="Open"]

Tips, Tricks, Gotchas & Best Practices:

  • As an alternative to the tap, you can use the tapAt and preciseTap command with coordinates to perform the tap action.
  • In case you want to perform two tap actions on the same element, you can use doubleTap. It performs the tap action twice in a single go.
  • If the above-mentioned commands fail to perform the tap action, then you can use the click command as an alternative.
  • As a best practice, you are encouraged to validate the visibility of any element that is expected to be displayed after the tap action using assertVisible, verifyVisible or waitForVisible commands.

Feedback and Knowledge Base