Skip to content

How do I get the size of an element for a native mobile app?

The example demonstrates how to get the size of an element for a native mobile app.

The storeElementSize command returns the length and width of the element in pixels as a tuple (x,y).

In the solution below, we get the size of the ‘Age’ input field using the ‘storeElementSize’ command for the HICC app.

Solution:

# Command Target Value
Get size of the age input field
1 storeElementSize id=age ageInputFieldSize

Tips, Tricks, Gotchas & Best Practices:

  • It is a good practice to verify if the element whose size you want to get is properly visible (and accessible) on the screen. We can use the assertVisible or verifyVisible commands before storeElementSize to confirm.

Feedback and Knowledge Base