Skip to content

How do I perform tap action based on the coordinate values in a Mobile App

This example demonstrates how to perform tap action on links, buttons, check-boxes or radio buttons based on the coordinates.

In the solution shown below, you will see that tap action is performed on the "Calculate" button in HICC using the "preciseTap" command by providing the coordinate values in the "Target" field.

Solution:

# Command Target Value
Tap on the "Calculate" button
1 preciseTap 200,830  

Tips, Tricks, Gotchas & Best Practices:  

  • You can get the coordinates from Appium Inspector.  
  • The screen size varies for every device hence the coordinates of one device may not work for the other. You can use the storeElementLocation command to get the coordinates for the required element and call it in the "preciseTap" command.
  •  As an alternative to "preciseTap" command, you can use tap command to perform tap action based on the locator.  
  • As a best practice, you are encouraged to validate visibility of any element that is expected to be displayed after the tap action using assertVisible, verifyVisible or waitForVisible commands.
 
 

Feedback and Knowledge Base