In addition to the CMD direct operation of the phone, you can also edit the script, run the script, one time to manipulate multiple script commands
A) Create a new py format script, such as ireader.py
b) Edit the script #导入模块
From Com.android.monkeyrunner import Monkeyrunner, monkeydevice,monkeyimage
Monkeyrunner.sleep (1)
#连接设备
device = Monkeyrunner.waitforconnection ()
#滑动解销
Device.drag ((360,1008), (616,1016), 0.1,10) Monkeyrunner.sleep (2)
#点击Home键
Device.press (' Keycode_home ', ' down_and_up ')
#导入安装包并安装
Device.installpackage (' E ' \haitao.apk ')
#启动程序
Device.startactivity (component= ' component= ' com.shantao/com.shantao.launchactivity ')
#登录输入
Device.type (' 123456 ')
c) Run the script, under the cmd window
Input Monkeyrunner F:\iReader.py
Basic can be run, the script is running faster, the middle time lag comparison good monkeyrunner.sleep (1)
Monkeyrunner Learning (3) editing scripts