Issue
i would like to simulate touch on my anroid phone through a python code on my computer using the "adb shell tap x y" function (or any other way you may know). I have tried using
from subprocess import call
call(["adb", "kill-server"])
call(["adb", "shell"])
call(["input", "tap" , "1400" , "800"]) //example of x and y
but it just reaches the "shell" call and gets stuck. (I know the tap function works because it works on the ordinary cmd window)
Solution
This should do it:
from subprocess import call
call(["adb", "shell", "input", "tap" , "1400" , "800"])
In your original script:
- You start a remote shell on your Android device (
adb shell
) - After you quit the remote shell typing
exit
, you issue a command on your host computer shell (input tap 1400 800
).
Instead you should use adb to redirect a command to the Android device's remote shell. To do that, just append the command after adb shell
, for example adb shell input tap 1400 800
. Take a look here.
I also removed the adb kill-process
line because there is no kill-process
adb command.
Answered By - Gil Vegliach
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.