Skip to content Skip to sidebar Skip to footer

Device.touch() Is Not Working Properly For Gallery Application

I am creating a script to test gallery app of android 4.0.4. using monkeyrunner. But when I am sending touch event to any album it gets selects the album instead opening it. below

Solution 1:

this the limitation of the MonkeyRunner , that it can not handle non interactive items. For this issue bug has been logged in the google groups http://code.google.com/p/android/issues/detail?id=19452

I am able to open the album by making a script which contains the following commands:

adb shell sendevent /dev/input/event2 0 0 0
adb shell sendevent /dev/input/event2 2 0 -1000
adb shell sendevent /dev/input/event2 0 0 0
adb shell sendevent /dev/input/event2 2 1 -1000
adb shell sendevent /dev/input/event2 0 0 0
adb shell sendevent /dev/input/event2 2 0 500
adb shell sendevent /dev/input/event2 0 0 0
adb shell sendevent /dev/input/event2 2 1 500
adb shell sendevent /dev/input/event2 0 0 0
adb shell sendevent /dev/input/event2 2 0 80
adb shell sendevent /dev/input/event2 0 0 0
adb shell sendevent /dev/input/event2 2 1 80
adb shell sendevent /dev/input/event2 0 0 0
adb shell sendevent /dev/input/event2 1 272 1
adb shell sendevent /dev/input/event2 0 0 0
adb shell sendevent /dev/input/event2 1 272 0
adb shell sendevent /dev/input/event2 0 0 0

your monkeyrunner script should contains the following lines after running your gallery activity:

try:
    subprocess.Popen(['bash', '-c', '. .Script_name.sh'])     
except:
    raise Exception('Could not open the File: script_name.sh')

Post a Comment for "Device.touch() Is Not Working Properly For Gallery Application"