运行adb devices获取连接设备
例如:
C:\Documents and Settings\Administrator>adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
emulator-5554 device
HT23LV804061 device
启动Monkeyrunner
1、切入tools目录,输入命令:"monkeyrunner" 回车
2、引入monkeyrunner需要的两个模块
from com.android.monkeyrunner i mport MonkeyRunner, MonkeyDevice 回车
3、把设备和monkey绑定,绑定后在monkeyrunner的操作等同于在设备的操作
device=MonkeyRunner.waitForConnection(5,'手机名') #手机名为‘HT23LV804061’
这样就可以连接手机了,而非模拟器