For some reason no matter what I do I can't issue a 'drag' command to my external android device using AndroidViewClient. Here is my code:
import sys
import os
import time
try:
sys.path.append(os.path.join(os.environ['ANDROID_VIEW_CLIENT_HOME'], 'src'))
except:
pass
from com.dtmilano.android.adb.adbclient import AdbClient
from com.dtmilano.android.viewclient import ViewClient, View
print 'Connecting to device...'
device, serialno = ViewClient.connectToDeviceOrExit()
time.sleep(.5)
AdbClient(serialno='.*').drag((500,1000),(500,100), 1, 10)
I have also tried
device.drag((500,1000),(500,100), 1, 10)
which also does not work. (btw, how does device.drag() differ from AdbClient.drag()?)
Also, I am NOT getting any errors from the above. Everything runs, and no errors are found. It just does not drag the screen.
Yet, touch events and keyboard events work:
device.touch(400,200, 'DOWN_AND_UP')
Note: my version of AndroidViewCLient is 7.0.2. My android device is Jellybean 4.1
EDIT: Ouput for my android device:
C:\Users\Me>adb shell input
usage: input ...
input text <string>
input keyevent <key code number or name>
input tap <x> <y>
input swipe <x1> <y1> <x2> <y2>
I found the problem. When AdbClient
gets the API level (version) it's not converted to int
so then the comparison in AdbClient.drag()
fails because it's a string and the wrong command is sent to API 16.
This:
__send(shell:input touchscreen swipe 500 400 100 400 1, checkok=True, reconnect=False)
instead of
__send(shell:input swipe 500 400 100 400, checkok=True, reconnect=False)
It will be fixed in AVC 7.0.4.