失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > android 脚本模拟点击屏幕 android 脚本模拟点击屏幕 android模拟

android 脚本模拟点击屏幕 android 脚本模拟点击屏幕 android模拟

时间:2019-09-17 13:59:09

相关推荐

android 脚本模拟点击屏幕 android 脚本模拟点击屏幕 android模拟

android 脚本模拟点击屏幕,android模拟

对低概率问题,需要多次测试以复现问题,使用脚本更容易实现,避免频繁人工操作

首先要了解手机的众多输入设备:

命令:adb shell cat /proc/bus/input/devices/

I: Bus=0000 Vendor=0000 Product=0000 Version=0000

N: Name="qpnp_pon"

P: Phys=qpnp_pon/input0

S: Sysfs=/devices/virtual/input/input0

U: Uniq=

H: Handlers=event0

B: PROP=40

B: EV=3

B: KEY=14000000000000 0

I: Bus=0018 Vendor=0000 Product=0000 Version=0000

N: Name="qcom-tpd"

P: Phys=

S: Sysfs=/devices/soc/78b7000.i2c/i2c-3/3-0038/input/input1

U: Uniq=

H: Handlers=mdss_fb kgsl event1

B: PROP=2

B: EV=b

B: KEY=ff000000000000 0 0 0 0 0 400 0 0 0 160000000000 4004001400000

B: ABS=261800000000000

I: Bus=0000 Vendor=0000 Product=0000 Version=0000

N: Name="gf5216"

P: Phys=

S: Sysfs=/devices/virtual/input/input2

U: Uniq=

H: Handlers=event2

B: PROP=0

B: EV=3

B: KEY=2000000040000800 1016c000000008 0

I: Bus=0000 Vendor=0000 Product=0000 Version=0000

N: Name="qwerty"

P: Phys=

S: Sysfs=/devices/virtual/input/input3

U: Uniq=

H: Handlers=event3

B: PROP=0

B: EV=3

B: KEY=2000000040000800 1016c000000008 0

I: Bus=0019 Vendor=0001 Product=0001 Version=0100

N: Name="gpio-keys"

P: Phys=gpio-keys/input0

S: Sysfs=/devices/soc/soc:gpio_keys/input/input4

U: Uniq=

H: Handlers=event4

B: PROP=0

B: EV=3

B: KEY=4000000000000000 0 0 10000 0 0 0 0 0 0 8000000000000 0

I: Bus=0000 Vendor=0000 Product=0000 Version=0000

N: Name="msm8952-snd-card-mtp Headset Jack"

P: Phys=ALSA

S: Sysfs=/devices/soc/c051000.sound/sound/card0/input5

U: Uniq=

H: Handlers=event5

B: PROP=0

B: EV=21

B: SW=3c0d4

I: Bus=0000 Vendor=0000 Product=0000 Version=0000

N: Name="msm8952-snd-card-mtp Button Jack"

P: Phys=ALSA

S: Sysfs=/devices/soc/c051000.sound/sound/card0/input6

U: Uniq=

H: Handlers=event6

B: PROP=40

B: EV=3

B: KEY=e0 400000000 0 c000000000000 0

对应输入设备的Name匹配我们需要使用的设备信息,

I: Bus=0018 Vendor=0000 Product=0000 Version=0000

N: Name="qcom-tpd"

P: Phys=

S: Sysfs=/devices/soc/78b7000.i2c/i2c-3/3-0038/input/input1

U: Uniq=

H: Handlers=mdss_fb kgsl event1

B: PROP=2

B: EV=b

B: KEY=ff000000000000 0 0 0 0 0 400 0 0 0 160000000000 4004001400000

B: ABS=261800000000000

发现给设备对应tp。

命令:adb shell getevent1 /dev/input/event1

输入该命令后,做点击屏幕操作,这里我们以点击拍照为例:

终端输出:

0003 0039 00000000

0003 0030 00000003

0003 0035 00000163

0003 0036 00000476

0001 014a 00000001

0000 0000 00000000

0003 0030 00000004

0000 0000 00000000

0001 014a 00000000

0000 0000 00000000

注意:点击不同的点会输出不同的信息,这里的输出对应这点击事件的具体信息,我们之需要在脚本中做写下相同的命令既可以实现同样的操作

下面开始写脚本使用sendevent命令(这里需要注意的是,上买你的输出为十六进制,需要自行转换成十进制):

sendevent /dev/input/event1 0003 57 00000000

sendevent /dev/input/event1 0003 48 00000003

sendevent /dev/input/event1 0003 53 355

sendevent /dev/input/event1 0003 54 1142

sendevent /dev/input/event1 0001 330 00000001

sendevent /dev/input/event1 0000 0000 00000000

sendevent /dev/input/event1 0003 48 00000004

sendevent /dev/input/event1 0000 0000 00000000

sendevent /dev/input/event1 0001 330 00000000

sendevent /dev/input/event1 0000 0000 00000000

写完脚本touch.sh文件

使用命令afb push touch.sh /sdcard/把脚本导入手机

然后执行adb shell sh /sdcard/touch.sh

确认手机是否会出现同样操作

根据这个步骤也可以尝试写一些相关其他设备的输入,当我们需要重复点击时,之需要在脚本写个循环就可以实现自动压力测试了

/wlwjskf/1312561.true/wlwjskf/1312561.htmlTechArticleandroid 脚本模拟点击屏幕,android模拟 对低概率问题,需要多次测试以复现问题,使用脚本更容易实现,避免频繁人工操作 首先要了解手机...

如果觉得《android 脚本模拟点击屏幕 android 脚本模拟点击屏幕 android模拟》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。