51Testing软件测试论坛

标题: 【求教】MonkeyRecorder显示空白 [打印本页]

作者: 蓝天碧雲    时间: 2016-10-20 15:21
标题: 【求教】MonkeyRecorder显示空白
最近在学习monkeyrunner,想用MonkeyRecorder获取APP控件坐标(连接真机),但启动MonkeyRecorder后报错且显示空白(见截图),有人知道什么原因吗?
《MonkeyRecorder.py》代码如下:
from com.android.monkeyrunner import MonkeyRunner as mr
from com.android.monkeyrunner.recorder import MonkeyRecorder as recorder
device = mr.waitForConnection(1,'设备号')
recorder.start(device)


报错信息(第一部分,第二部分在楼下):
E:\sdk>monkeyrunner G:\AutoTest\MonkeyRecorder.py
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce] Unable to take snapshot
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]com.android.ddmlib.TimeoutException
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at com.android.ddmlib.AdbHelper.read(AdbHelper.java:686)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at com.android.ddmlib.AdbHelper.read(AdbHelper.java:654)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at com.android.ddmlib.AdbHelper.getFrameBuffer(AdbHelper.java:327)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at com.android.ddmlib.Device.getScreenshot(Device.java:558)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at com.android.chimpchat.adb.AdbChimpDevice.takeSnapshot(AdbChimpDevice.
java:209)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at com.android.monkeyrunner.recorder.MonkeyRecorderFrame.refreshDisplay(
MonkeyRecorderFrame.java:115)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at com.android.monkeyrunner.recorder.MonkeyRecorderFrame.access$000(Monk
eyRecorderFrame.java:60)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at com.android.monkeyrunner.recorder.MonkeyRecorderFrame$2.run(MonkeyRec
orderFrame.java:109)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.awt.EventQueue.access$200(EventQueue.java:103)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.awt.EventQueue$3.run(EventQueue.java:682)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.awt.EventQueue$3.run(EventQueue.java:680)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.security.AccessController.doPrivileged(Native Method)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDo
main.java:76)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
ad.java:242)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
java:161)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:150)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
161020 14:46:14.792:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at com.android.monkeyrunner.recorder.MonkeyRecorderFrame.refreshDisplay(
MonkeyRecorderFrame.java:116)
        at com.android.monkeyrunner.recorder.MonkeyRecorderFrame.access$000(Monk
eyRecorderFrame.java:60)
        at com.android.monkeyrunner.recorder.MonkeyRecorderFrame$2.run(MonkeyRec
orderFrame.java:109)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
        at java.awt.EventQueue.access$200(EventQueue.java:103)
        at java.awt.EventQueue$3.run(EventQueue.java:682)
        at java.awt.EventQueue$3.run(EventQueue.java:680)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDo
main.java:76)




作者: 蓝天碧雲    时间: 2016-10-20 15:22
报错信息第二部分:
161020 14:46:19.863:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
161020 14:46:19.863:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
ad.java:242)
161020 14:46:19.863:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
java:161)
161020 14:46:19.863:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:150)
161020 14:46:19.863:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)

161020 14:46:19.863:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)

161020 14:46:19.863:S [AWT-EventQueue-0] [com.android.chimpchat.adb.AdbChimpDevi
ce]     at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at com.android.monkeyrunner.recorder.MonkeyRecorderFrame.refreshDisplay(
MonkeyRecorderFrame.java:116)
        at com.android.monkeyrunner.recorder.MonkeyRecorderFrame.access$000(Monk
eyRecorderFrame.java:60)
        at com.android.monkeyrunner.recorder.MonkeyRecorderFrame$1.actionPerform
ed(MonkeyRecorderFrame.java:89)
        at javax.swing.Timer.fireActionPerformed(Timer.java:312)
        at javax.swing.Timer$DoPostEvent.run(Timer.java:244)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721)
        at java.awt.EventQueue.access$200(EventQueue.java:103)
        at java.awt.EventQueue$3.run(EventQueue.java:682)
        at java.awt.EventQueue$3.run(EventQueue.java:680)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDo
main.java:76)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:691)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
ad.java:242)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
java:161)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:150)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
作者: 梦想家    时间: 2016-10-20 15:46
连接ANDROID设备了么
作者: 蓝天碧雲    时间: 2016-10-20 16:06
梦想家 发表于 2016-10-20 15:46
连接ANDROID设备了么

连接了。
作者: 海里的幸福    时间: 2016-10-31 17:58
世上没有绝望的处境,只有对处境绝望的人。
作者: wubo111    时间: 2018-11-28 16:51
遇到同样的问题,请问大佬解决了没,求教
作者: wubo111    时间: 2018-11-28 16:52
遇到同样的问题,请问大佬解决了没,求教
作者: yinXlms    时间: 2020-9-14 18:03
device = mr.waitForConnection(1,'设备号')
这里要填具体的设备号,可以用adb devices命令查看




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2