I've tested MagicMarker using this simple AndroidViewClient script.
Notice that some fixes to adbclient.drag()
were introduced in version 5.1.1 so be sure you have the latest version.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright (C) 2014 Diego Torres Milano
'''
__requires__ = ["androidviewclient >= 5.1.1"]
import pkg_resources
from com.dtmilano.android.adb.adbclient import AdbClient
AdbClient(serialno='.*').drag((100, 100), (400, 400), 1000)
This produces:
Also notice than in your script device
is the AdbClient
instance.
If you check how drag()
is implemented in AdbClient
, you'll see that is using input swipe
with parameters according to the corresponding API level:
def drag(self, (x0, y0), (x1, y1), duration, steps=1):
'''
Sends drag event (actually it's using C{input swipe} command.
@param (x0, y0): starting point
@param (x1, y1): ending point
@param duration: duration of the event in ms
@param steps: number of steps (currently ignored by @{input swipe}
'''
version = int(self.getProperty('ro.build.version.sdk'))
if version <= 15:
raise RuntimeError('drag: API <= 15 not supported (version=%d)' % version)
elif version <= 17:
self.shell('input swipe %d %d %d %d' % (x0, y0, x1, y1))
else:
self.shell('input swipe %d %d %d %d %d' % (x0, y0, x1, y1, duration))