OpenHarmony开发者论坛
标题:
有什么工具可以模拟按键点击吗
[打印本页]
作者:
xt1024
时间:
2023-10-30 11:16
标题:
有什么工具可以模拟按键点击吗
[md]我想自动化测试,有什么工具可以模拟按键点击吗?
[/md]
作者:
深开鸿_张亮亮
时间:
2023-10-30 11:46
自动化测试可以参考OpenHarmony官方提供的工具
https://docs.openharmony.cn/pages/v3.2/zh-cn/application-dev/application-test/wukong-guidelines.md/
如果是单纯的想模拟按键可以通过下列命令,以back按键为例
uinput -K -d 2 -u 2
复制代码
下面是uinput命令的guide
# uinput -h
uinput: unrecognized option: h
Usage: uinput <option> <command> <arg>...
The option are:
-M --mouse
commands for mouse:
-m <dx> <dy> --move <dx> <dy> -move to relative position (dx,dy),
<dx1> <dy1> <dx2> <dy2> [soomth time] --trace -dx1 dy1 to dx2 dy2 smooth movement
-d <key> --down key -press down a button,
0 is the left button, 1 is the right,
2 is the middle
-u <key> --up <key> -release a button
-c <key> --click <key> -press the left button down,then raise
-b <dx1> <dy1> <id> [press time] [click interval time] --double click
[press time] the time range is more than 1ms but less than 300ms,
[click interval time] the time range is more than 1ms but less than 450ms,
Otherwise the operation result may produce error or invalid operation
-press the left button down,then raise
key value:0 - button left
key value:1 - button right
key value:2 - button middle
key value:3 - button side
key value:4 - button extra
key value:5 - button forward
key value:6 - button back
key value:7 - button task
-s <key> --scroll <key> -positive values are sliding backwards
-i <time> --interval <time> -the program interval for the (time) milliseconds
negative values are sliding forwards
-K --keyboard
commands for keyboard:
-d <key> --down <key> -press down a key
-u <key> --up <key> -release a key
-l <key> [long press time] --long_press <key> [long press time] -press and hold the key
-i <time> --interval <time> -the program interval for the (time) milliseconds
-T --touch
commands for touch:
-d <dx1> <dy1> --down <dx1> <dy1> -press down a position dx1 dy1,
-u <dx1> <dy1> --up <dx1> <dy1> -release a position dx1 dy1,
-m <dx1> <dy1> <dx2> <dy2> [smooth time] --smooth movement
<dx1> <dy1> <dx2> <dy2> [smooth time] -smooth movement,
dx1 dy1 to dx2 dy2 smooth movement
-c <dx1> <dy1> [click interval] -touch screen click dx1 dy1
-i <time> --interval <time> -the program interval for the (time) milliseconds
-g <dx1> <dy1> <dx2> <dy2> [press time] [total time] -drag,
[Press time] not less than 500ms and [total time] - [Press time] not less than 500ms
Otherwise the operation result may produce error or invalid operation
-? --help
复制代码
作者:
westinyang
时间:
2023-10-30 11:50
[md]OHScrcpy:
https://www.bilibili.com/read/cv24125018
DevEcoTesting:
https://devecotesting.huawei.com/userPortal
[/md]
欢迎光临 OpenHarmony开发者论坛 (https://forums.openharmony.cn/)
Powered by Discuz! X3.5