1

DroidBox23で動作するmonkeyrunnerスクリプトを使用しています。これは、DroidBoxプログラムのデフォルトでスクリプト/フォルダーにあるスクリプトですが、次のように変更しました。

    import re
    import sys
    import os
    import time

    from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice

    device = MonkeyRunner.waitForConnection()
    device.installPackage(sys.argv[1])
    package = sys.argv[2]
    activity = sys.argv[3]

    # sets the name of the component to start
    runComponent = package + '/' + activity
    print "Running: " + runComponent
    # Runs the component
    device.startActivity(component=runComponent)

    time.sleep(5)
    # Takes a screenshot
    print "Taking snapshot"
    result = device.takeSnapshot()
    # Writes the screenshot to a file
    result.writeToFile('shot1.png','png')
    print 'pulsamos'
    device.press("DPAD_UP", 'DOWN_AND_UP')
    print 'pulsado'
    device.touch(60,350, 'DOWN_AND_UP')

device.press() または device.touch() を実行すると、これらの関数は機能しません。

    130509 17:23:38.641:S [main] [com.android.chimpchat.adb.AdbChimpDevice] Error sending touch event: 60 350 DOWN_AND_UP
130509 17:46:42.657:S [main] [com.android.chimpchat.adb.AdbChimpDevice]java.net.SocketException: Broken pipe
130509 17:46:42.657:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java.net.SocketOutputStream.socketWrite0(Native Method)
130509 17:46:42.657:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java.net.SocketOutputStream.socketWrite(Unknown Source)
130509 17:46:42.657:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at java.net.SocketOutputStream.write(Unknown Source)
130509 17:46:42.657:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at sun.nio.cs.StreamEncoder.writeBytes(Unknown Source)
130509 17:46:42.657:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at sun.nio.cs.StreamEncoder.implFlushBuffer(Unknown Source)
130509 17:46:42.657:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at sun.nio.cs.StreamEncoder.implFlush(Unknown Source)
130509 17:46:42.657:S [main] [com.android.chimpchat.adb.AdbChimpDevice] at sun.nio.cs.StreamEncoder.flush(Unknown Source)

ご協力いただきありがとうございます。

4

0 に答える 0