|
Monkeyrunner 能控制真手机吗?不是模拟器!
为什么那些press, touch,drag的命令在模拟器上运行OK,但在真手机上运行就出错?
此外,用recorder连接真手机进行录制,进行点击之类的操作的时候也会出一样的错。
是我哪里弄错了吗?还是Monkeyrunner 能不能控制真手机?还是只能在模拟器上运行?
>>> from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage
>>> device = MonkeyRunner.waitForConnection()
下面这句会出错:
>>> device.press('KEYCODE_MENU',MonkeyDevice.DOWN_AND_UP)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] Error se
nding press event: KEYCODE_MENU DOWN_AND_UP
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice]java.net.SocketException: Software caused connection abort: recv failed
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java.
net.SocketInputStream.socketRead0(Native Method)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java.
net.SocketInputStream.read(SocketInputStream.java:129)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at sun.n
io.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at sun.n
io.cs.StreamDecoder.implRead(StreamDecoder.java:306)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at sun.n
io.cs.StreamDecoder.read(StreamDecoder.java:158)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java.
io.InputStreamReader.read(InputStreamReader.java:167)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java.
io.BufferedReader.fill(BufferedReader.java:136)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java.
io.BufferedReader.readLine(BufferedReader.java:299)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java.
io.BufferedReader.readLine(BufferedReader.java:362)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.a
ndroid.chimpchat.ChimpManager.sendMonkeyEventAndGetResponse(ChimpManager.java:18
7)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.a
ndroid.chimpchat.ChimpManager.sendMonkeyEvent(ChimpManager.java:234)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.a
ndroid.chimpchat.ChimpManager.press(ChimpManager.java:134)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.a
ndroid.chimpchat.adb.AdbChimpDevice.press(AdbChimpDevice.java:322)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.a
ndroid.monkeyrunner.MonkeyDevice.press(MonkeyDevice.java:193)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at sun.r
eflect.NativeMethodAccessorImpl.invoke0(Native Method)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at sun.r
eflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at sun.r
eflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java.
lang.reflect.Method.invoke(Method.java:597)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p
ython.core.PyReflectedFunction.__call__(PyReflectedFunction.java:175)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p
ython.core.PyObject.__call__(PyObject.java:355)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p
ython.core.PyMethod.__call__(PyMethod.java:215)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p
ython.core.PyMethod.instancemethod___call__(PyMethod.java:221)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p
ython.core.PyMethod.__call__(PyMethod.java:206)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p
ython.core.PyObject.__call__(PyObject.java:414)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p
ython.core.PyObject.__call__(PyObject.java:418)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p
ython.pycode._pyx5.f$0(<stdin>:1)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p
ython.pycode._pyx5.call_function(<stdin>)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p
ython.core.PyTableCode.call(PyTableCode.java:165)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p
ython.core.PyCode.call(PyCode.java:18)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p
ython.core.Py.runCode(Py.java:1197)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p
ython.core.Py.exec(Py.java:1241)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p
ython.util.PythonInterpreter.exec(PythonInterpreter.java:147)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p
ython.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:89)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p
ython.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:70)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p
ython.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:46)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p
ython.util.InteractiveConsole.push(InteractiveConsole.java:110)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p
ython.util.InteractiveConsole.interact(InteractiveConsole.java:90)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at org.p
ython.util.InteractiveConsole.interact(InteractiveConsole.java:60)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.a
ndroid.monkeyrunner.ScriptRunner.console(ScriptRunner.java:193)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.a
ndroid.monkeyrunner.MonkeyRunnerStarter.run(MonkeyRunnerStarter.java:73)
120424 15:40:38.501:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at com.a
ndroid.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter.java:189)
>>> |
|