亚行发送触摸事件到设备 [英] send touch event from ADB to a device

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

问题描述

我想触摸事件发送到使用亚行的shell命令的设备,这样我就可以做一些基本的自动化UI测试。我已经遵循了有关这方面的一些previous线程的讨论。

I am trying to send touch events to a device using ADB shell command, so that I can do some basic automation for UI tests. I have followed the discussion in some previous threads regarding this.

我证实了有关获取的事件,并使用sendevents,送出6事件每个触摸(XCOORD,YCOORD,2 preSS,2版本),并很容易利用这些信息来sendevents,但getevent用于触摸屏的设备似乎产生太多的事件。

I confirmed about getting the events and using sendevents,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 event from ADB to a device? Could you please share the solution.

我真的AP preciate你的帮助。

I really appreciate your help.

我的工作记录触摸事件的电话。从那以后,我希望同样的事件发回设备的UI测试的一部分。

I am working on recording the touch events on phone. After that i wish to send the same event back to the device as part of UI testing.

请帮忙

推荐答案

要发送触摸事件,你需要做的:

To send touch event you need to do:

1组坐标:

adb shell sendevent /dev/input/event2 3 0 x
adb shell sendevent /dev/input/event2 3 1 y

2发送触摸事件(必须有0 0 0对):

2 Send touch event (must have 0 0 0 pair):

adb shell sendevent /dev/input/event2 1 330 1
adb shell sendevent /dev/input/event2 0 0 0

3发送释放手指的事件(必须有0 0 0对):

3 Send release finger event (must have 0 0 0 pair):

adb shell sendevent /dev/input/event2 1 330 0
adb shell sendevent /dev/input/event2 0 0 0

请注意:

1,您可以记录事件:

1 You can record events:

adb shell getevent

2,如果您使用getevent所有的事件值是十六进制。

2 if you use getevent all event values are in hex.

最好的问候, Yahor

Best regards, Yahor

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

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