adb shell tap function with X and y position for All type of Android devices

1.5k Views Asked by At

image shows the login and logout so i want to test this app for 1000 times using shell script. here is my flow below is code

`Analytics_test(){
#to launch the app use below command 
adb shell am start -n  pacagename/activaity
sleep 1
#to clcik on Anlyatics Test 
adb shell input tap 146 193
sleep 1
# to click on login 
adb shell input tap 386 136
sleep 1
#to logout 
adb shell input tap 386 136
sleep 1
adb shell input tap 399 300
sleep 1
# to click on back 
adb shell input tap 474 1401 }

#iteration for 20 times for (( i=0; i<=20; i++ )) do Analytics_test done`

so my question is for one mobile device say one plus 8 pro i can find out x and y value for tap touch but when i run same script for other device like Samsung s20 or all other Android device the script doesnot not work due to wrong x and y value for touch login and logout

so is there any method in Android so we can get the x and y value for tap touch position will get auto updated if we change the device

0

There are 0 best solutions below