Search code examples
androidpythonautomationmonkeyrunner

Monkeyrunner: How do you access elements using their relative position instead of absolute co-ordinates?


I want to automate testing of an android app, and monkeyrunner is a tool I am considering using as it works with python (I haven't learned java).

I have automated desktop webpage testing using Selenium WebDriver before and that allowed me to access elements via their html attributes or relative Xpath, but looking at the monkeyrunner api, it seems you can only use absolute x,y coordinates, which is not useful due to the varying sizes of android devices.

Is there a way other than absolute positioning to access elements using monkeyrunner?


Solution

  • Take a look at AndroidViewclient/culebra. It locates Views based on their attributes like id, text, content description, etc.