0

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?

user3873725
  • 67
  • 1
  • 4

2 Answers2

0

You could use uiautomator. It's a tool from Google used to test the UI. You can use it to test apps from a fake user perspective. You can simulate clicks, drags, long presses on elements identified by their id or a combination of properties.

http://developer.android.com/tools/help/uiautomator/index.html

The tests can be written in Java. However, there is a Python wrapper for this and it works great. Have a look at:

https://github.com/xiaocong/uiautomator

It has most of the original tool's features and the scripts are easier to write.

Gabriel Porumb
  • 1,661
  • 1
  • 12
  • 21
0

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

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134