我有带有 ID 为 R.id.createRepository 的选项菜单的 android 活动。现在我想使用猴子跑步者向它发送触摸事件。我需要获取视图 ID,并尝试了以下代码:
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
但是moneyrunner 找不到视图。我需要帮助来定义正确的视图 ID。
问候,
米腾