Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keyevent to click on Alert Dialog of Android screen

Is there any way to simulate keyevent on "OK" or "CANCEL" buttons of Android dialogue box using adb commands?

like image 939
Fresher Avatar asked Jan 12 '23 22:01

Fresher


1 Answers

One indirect way is:-

adb shell uiautomator dump /data/view.xml
adb shell cat /data/view.xml

calculate OK button coordinates from the relative coordinates given in the xml file. Then do

adb shell input tap <x> <y>

Hope works.

like image 142
Rilwan Avatar answered Jan 23 '23 05:01

Rilwan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!