我使用 android MonkeyRunner 做一些测试
每次运行 Monkeyruuner.sleep() 都会失败
像这样
from com.android.monkeyrunner import MonkeyRunner
device = MonkeyRunner.waitForConnection()
device.press('KEYCODE_ENTER', 'DOWN_AND_UP')
MonkeyRunner.sleep(10)
device.press('KEYCODE_ENTER', 'DOWN_AND_UP')
在第二
device.press('KEYCODE_ENTER', 'DOWN_AND_UP')
总是失败
[main] [com.android.chimpchat.adb.AdbChimpDevice] Error sending press event: KEYCODE_ENTER DOWN_AND_UP
请帮忙谢谢'谢谢大家的回复!
但即使使用 time.sleep() 或 MonkeyDevice.DOWN_AND_UP 总是有错误
我的分数代码
from com.android.monkeyrunner import MonkeyRunner
import time
device = MonkeyRunner.waitForConnection()
device.press('KEYCODE_DPAD_RIGHT', device.DOWN)
device.press('KEYCODE_DPAD_RIGHT', device.UP)
time.sleep(2)
device.press('KEYCODE_DPAD_RIGHT', device.DOWN)
device.press('KEYCODE_DPAD_RIGHT', device.UP)
time.sleep(2)
device.press('KEYCODE_DPAD_RIGHT', device.DOWN)
device.press('KEYCODE_DPAD_RIGHT', device.UP)
time.sleep(2)
三下下来,上来总是错的
日志
120718 09:50:51.744:S [main] [com.android.chimpchat.adb.AdbChimpDevice] Error sending press event: KEYCODE_DPAD_RIGHT DOWN
120718 09:50:51.744:S [main][com.android.chimpchat.adb.AdbChimpDevice]java.net.SocketException: Software caused connection abort: recv failed
120718 09:50:51.744:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java.net.SocketInputStream.socketRead0(Native Method)
120718 09:50:51.744:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java.net.SocketInputStream.read(Unknown Source)
120718 09:50:51.744:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at
谢谢!