单击Android屏幕的Alert对话框的Keyevent [英] Keyevent to click on Alert Dialog of Android screen

查看:105
本文介绍了单击Android屏幕的Alert对话框的Keyevent的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以使用adb命令在Android对话框的确定"或取消"按钮上模拟按键事件?

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

推荐答案

一种间接方式是:-

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

根据xml文件中给出的相对坐标来计算确定"按钮的坐标. 然后做

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

adb shell input tap <x> <y>

希望有效.

这篇关于单击Android屏幕的Alert对话框的Keyevent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆