After reading posts I figured out how to emulate a touch event :
adb shell input tap 100 100
I've installed MagicMarker in order to see if anything is drawn, nothing appears.
I've also tried with monkeyrunner/androidViewClient Touch functions :
device.touch(100 , 100, 'DOWN_AND_UP');
My whole code for AndroidViewClient :
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import getopt, sys
import os
# Add android to path becayuse it seems to not appear on windows
sys.path.append("D:/Dev/adt-bundle-windows-x86_64-20131030/sdk/tools")
sys.path.append("D:/Dev/adt-bundle-windows-x86_64-20131030/sdk/tools/lib")
sys.path.append("D:/Dev/adt-bundle-windows-x86_64-20131030/sdk/platform-tools")
# PyDev sets PYTHONPATH, use it
try:
for p in os.environ['PYTHONPATH'].split(':'):
if not p in sys.path:
sys.path.append(p)
except:
pass
try:
sys.path.append(os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'], 'src'))
except:
pass
from com.dtmilano.android.viewclient import ViewClient, ViewNotFoundException
device, serialno = ViewClient.connectToDeviceOrExit()
vc = ViewClient(device, serialno)
device.touch(100,100,"DOWN_AND_UP")
I successfully used device.press("KEYCODE_MENU", "DOWN_AND_UP") or device.takeSnapshot(), I don't understand at all why touch events are not received by my handset.
By the way, I am using real devices (a GS3 and GS4 both in 4.3)
Do not hesitate to ask further information.
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.This produces:
Also notice than in your script
device
is theAdbClient
instance.If you check how
drag()
is implemented inAdbClient
, you'll see that is usinginput swipe
with parameters according to the corresponding API level: