如何利用亚行发送触摸事件使用的SendEvent命令的设备? [英] How to use ADB to send touch events to device using sendevent command?

查看:207
本文介绍了如何利用亚行发送触摸事件使用的SendEvent命令的设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想触摸事件发送到使用AndroidDebugBridge的设备,这样我就可以做一些基本的自动化UI测试。我已按照<一个讨论href="http://groups.google.com/group/android-beginners/browse_thread/thread/8a5d8fa9229114d2/ce6e604f52b5318f?pli=1">LINK.我能够使用的SendEvent来模拟仿真器的触摸,但不能做同样的设备上。

I am trying to send touch events to a device using AndroidDebugBridge, so that I can do some basic automation for UI tests. I have followed the discussion in LINK. I am able to use sendevent to simulate touch on emulators, but unable to do the same on a device.

象在上述连结模拟器看起来​​发送6个事件为每个触摸(XCOORD,YCOORD,2为preSS,2释放)和很容易使用该信息来sendevents,但一个getevent为触摸屏的设备似乎产生太多的事件。

Like in above link the emulator seems to send out 6 events for each touch ( xcoord, ycoord, 2 for press,2 for release) and it was easy to use this information to sendevents, but a getevent for the touchscreen for a device seems to generate far too many events.

已经有人成功地从亚行发送触摸的设备?能否请您分享解决方案。

Has somebody managed to send touch from ADB to a device? Could you please share the solution.

推荐答案

机器人配备了一个输入命令行工具,它可以模拟其他输入事件。为了模拟攻,它是:

Android comes with an input command-line tool that can simulate miscellaneous input events. To simulate tapping, it's:

input tap x y

您可以使用亚行的shell(> 2.3.5)远程运行命令:

You can use the adb shell ( > 2.3.5) to run the command remotely:

adb shell input tap x y

这篇关于如何利用亚行发送触摸事件使用的SendEvent命令的设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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