TestProject Forum
Powered by leading experts in the test automation community

Can I click or tap on my mobile app by using location (x, y)?

In this case, I have a side menu in my app. And the menu items are generate dynamic by using API. So the Test Project inspector cannot detect the items. I think I have to click the items by location (x, y). There is any addon for this?

Hello,
Yes, there is an action to tap on screen coordinates.
It’s an action as opposed to an element action, and is called ‘Tap gesture at coordinates’

For reference, here are how screen coordinates are handles on mobile devices:

coordinates

Also, I would like to add, that even if your elements are generated dynamically, you can still attempt to construct a locator that will catch them regardless of changing structure, please see here for reference:

The article refers to web elements, but can still apply to mobile if this is your case.

Hello David,
Thanks for you answer.
The action is very useful! But I have some trouble when locating the coordinate. I think It should detect the coordinate when moving finger on my app. It’s good if there are some updates for it.

I also read the topic “Handling site generated element ID’s”. That is a suggestion.
Thank you very much.

Leo