0

So far I was only able to use the

adb shell input touchscreen swipe

approach using adb, and the

device.drag()

method from AndroidViewClient.

Both, though, take "speed" as a parameter, and the output is very relevant to the CPU clock speed and what processes are running in the background of the target device. I need something that simulates touching the screen, holding it in place and swiping, then stop moving and then being lifted. Those methods do not work in that way. MonkeyRunner should be able to do that by using DOWN and UP events, but it doesn't work to me as well - I keep getting Broken pipe exceptions (and I read that it's common since MonkeyRunner is buggy).

Any help would be much appreciated. Thanks.

Dakatine
  • 2,734
  • 1
  • 19
  • 20
  • The *duration* in the `input swipe` command is not *speed*. The inconsistencies in the outcomes of running the command with low duration values you observed have very little to do with CPU speed or load – Alex P. Oct 25 '16 at 00:28
  • What could make such a difference then? – Dakatine Oct 26 '16 at 12:08

1 Answers1

0

I tried this script (generated by culebra)

#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright (C) 2013-2016  Diego Torres Milano
Created on 2016-10-24 by Culebra v12.1.1
                      __    __    __    __
                     /  \  /  \  /  \  /  \ 
____________________/  __\/  __\/  __\/  __\_____________________________
___________________/  /__/  /__/  /__/  /________________________________
                   | / \   / \   / \   / \   \___
                   |/   \_/   \_/   \_/   \    o \ 
                                           \_____/--<
@author: Diego Torres Milano
@author: Jennifer E. Swofford (ascii art snake)
'''


import re
import sys
import os


try:
    sys.path.insert(0, os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'], 'src'))
except:
    pass

from com.dtmilano.android.viewclient import ViewClient

TAG = 'CULEBRA'

_s = 5
_v = '--verbose' in sys.argv


serialno = sys.argv[1]
duration = int(sys.argv[2])

kwargs1 = {'ignoreversioncheck': False, 'verbose': False, 'ignoresecuredevice': False}
device, serialno = ViewClient.connectToDeviceOrExit(serialno=serialno, **kwargs1)

device.dragDip((301.33, 140.67), (143.33, 400.67), duration, 20, 0)

I've just added serialno and duration parameters to be able to test different combinations.

Just to see the effect of changing the duration you can use a drawing app like this one

enter image description here

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134