51Testing软件测试论坛

标题: Monkeyrunner下运行press提示Error sending press event [打印本页]

作者: lavender_bj1    时间: 2011-10-17 15:09
标题: Monkeyrunner下运行press提示Error sending press event
我的环境:
Ubuntu10.04
Jython : 2.5.0
android-sdk-linux_x86_2.3(tools_r13-linux,platform-tools_r07-linux)
真机 MOPST800 (android2.3.4)

cd /home/validation/gongju/gb/android-sdk-linux_x86_2.3/tools
monkeyrunner
显示Jython 2.5.0 (Release_2_5_0:6476, Jun 16 2009, 13:33:26)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_22
单步运行下列语句正确。
>>> from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage
>>> device = MonkeyRunner.waitForConnection()
>>> device.installPackage('./ApiDemos.apk')
True
>>> device.startActivity(component='com.example.android.apis/.ApiDemos')
单步运行下句出错(100%)。
>>> device.press('KEYCODE_MENU','DOWN_AND_UP')
提示如下:
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice] Error sending press event: KEYCODE_DPAD_DOWN DOWN_AND_UP
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]java.net.SocketException: Broken pipe
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at java.net.SocketOutputStream.socketWrite0(Native Method)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:272)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:276)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:122)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:212)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at java.io.BufferedWriter.flush(BufferedWriter.java:236)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at com.android.monkeyrunner.MonkeyManager.sendMonkeyEventAndGetResponse

(MonkeyManager.java:167)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at com.android.monkeyrunner.MonkeyManager.sendMonkeyEvent

(MonkeyManager.java:214)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at com.android.monkeyrunner.MonkeyManager.press(MonkeyManager.java:116)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at com.android.monkeyrunner.adb.AdbMonkeyDevice.press

(AdbMonkeyDevice.java:291)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at com.android.monkeyrunner.MonkeyDevice.press(MonkeyDevice.java:202)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at sun.reflect.NativeMethodAccessorImpl.invoke

(NativeMethodAccessorImpl.java:39)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at sun.reflect.DelegatingMethodAccessorImpl.invoke

(DelegatingMethodAccessorImpl.java:25)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at java.lang.reflect.Method.invoke(Method.java:597)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:175)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at org.python.core.PyObject.__call__(PyObject.java:355)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at org.python.core.PyMethod.__call__(PyMethod.java:215)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:221)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at org.python.core.PyMethod.__call__(PyMethod.java:206)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at org.python.core.PyObject.__call__(PyObject.java:414)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at org.python.core.PyObject.__call__(PyObject.java:418)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at org.python.pycode._pyx8.f$0(<stdin>:1)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at org.python.pycode._pyx8.call_function(<stdin>)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at org.python.core.PyTableCode.call(PyTableCode.java:165)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at org.python.core.PyCode.call(PyCode.java:18)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at org.python.core.Py.runCode(Py.java:1197)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at org.python.core.Py.exec(Py.java:1241)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:147)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at org.python.util.InteractiveInterpreter.runcode

(InteractiveInterpreter.java:89)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at org.python.util.InteractiveInterpreter.runsource

(InteractiveInterpreter.java:70)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at org.python.util.InteractiveInterpreter.runsource

(InteractiveInterpreter.java:46)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at org.python.util.InteractiveConsole.push(InteractiveConsole.java:110)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:90)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:60)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at com.android.monkeyrunner.ScriptRunner.console(ScriptRunner.java:193)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at com.android.monkeyrunner.MonkeyRunnerStarter.run

(MonkeyRunnerStarter.java:89)
111017 10:35:28.378:S [main] [com.android.monkeyrunner.adb.AdbMonkeyDevice]        at com.android.monkeyrunner.MonkeyRunnerStarter.main

(MonkeyRunnerStarter.java:203)
作者: 八宝粥    时间: 2011-10-18 20:53
从log看貌似是ADB的问题。可以关闭DDMS等占用ADB的工具再试试。
作者: yyuanxiang    时间: 2011-11-14 19:41
跪求 touch x,y坐标的定位方法
作者: monkeytest15    时间: 2011-12-1 20:41
回复 3# yyuanxiang


    tools下面android原生带有工具的
作者: yyuanxiang    时间: 2011-12-3 12:43
使用eclipse+pydev写一个monkeyrunner的批处理,,输入from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice提示ImportError: No module named com.android.monkeyrunner错误, 请问是什么原因
作者: 40750118    时间: 2012-2-9 13:23
将type里面的DOWN_AND_UP变为MonkeyDevice.DOWN_AND_UP就可以了
作者: tanzhengping11    时间: 2012-4-28 11:10
回复 6# 40750118


修改为将type里面的DOWN_AND_UP变为MonkeyDevice.DOWN_AND_UP还是不行啊,
在真机上不行,在模拟器是没有问题。
作者: phoenixlwp    时间: 2012-6-28 15:04
回复 1# lavender_bj1 请问你这个问题解决了吗? 同样的问题求解中……
作者: chy2436447@    时间: 2013-5-11 15:39
同求,等待中.....




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