I have android activity with options menu with id as R.id.createRepository. Now I want to use monkey runner to send touch event to it. I need to get the view id and I tried below code:
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
from com.android.monkeyrunner.easy import EasyMonkeyDevice, By
device = MonkeyRunner.waitForConnection()
easy_device = EasyMonkeyDevice(device)
# Start your android app
# touch the view by id
easy_device.touch(By.id('id/createRepository'), MonkeyDevice.DOWN_AND_UP) # in activity java code I can refer to it as R.id.createRepository and I have even tried passing it in
but moneyrunner cannot find the view. I need help to define correct view id.
Regards,
Miten
You can use the uiautomatorviewer to find the id of the view. It's a tool located in the android-sdk folder under tools.
Just open your app in the screen where the view with the unknown id is located. Then open the uiautomatorviewer and take a screenshot. You will find the app layout with all the view details.