Convert pixel coordinates into percentage coordinates

Touch actions are used to scroll or swipe support pixel coordinates. Learn how to convert from relative to absolute coordinates.

The coordinates’ values in the device gestures operations, such as Touch and Swipe, can be either pixel coordinates or percentage coordinates. Following is the formula for converting pixel coordinates to percentage coordinates:

For example, for a Nexus 5 device with a resolution of 1080x1920, the following commands will perform the same operation:

  • Touch by coordinate in pixels

  • Touch by coordinate in percentage

Nice to know

  • The Resolution Width and Resolution Height values can be retrieved by using the Device info function.
  • (0%,0%) is the top left corner.
  • (100%,0%) is the top right corner.
  • (0%,100%) is the bottom left corner
  • (100%,100%) is the bottom right corner