简单的monkeyrunner 脚本
#导入包和类
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage
#连接设备
device = MonkeyRunner.waitForConnection()
#启动要测的应用的Activity         包名/ .当前目录下的Activity 名称
device.startActivity(component='com.example.zoe/.MainActivity')
#按下菜单键
device.press('KEYCODE_MENU','DOWN_AND_UP')
#截图操作
result = device.takeSnapshot()
#将截图的文件保存到D盘下面
result.writeToFile('D:\ad\shot1.png','png')