Android自动化工具Monkeyrunner使用(六) —— touch

来源:互联网 发布:免费报税软件 编辑:程序博客网 时间:2024/06/03 08:00

本章主要介绍touch事件

voidtouch ( integer x,integer y, string type)

Sends a touch event specified by type to the screen location specified by x and y.

Arguments
xThe horizontal position of the touch in actual device pixels, starting from the left of the screen in its current orientation.yThe vertical position of the touch in actual device pixels, starting from the top of the screen in its current orientation.typeThe type of key event to send. The allowed values are DOWN,UP, andDOWN_AND_UP.

stringDOWN

press() ortouch() value. Specifies that a DOWN event type should be sent to the device, corresponding to pressing down on a key or touching the screen.

stringUP

press() ortouch() value. Specifies that an UP event type should be sent to the device, corresponding to releasing a key or lifting up from the screen.

stringDOWN_AND_UP

press(),touch() ortype() value. Specifies that a DOWN event type followed by an UP event type should be sent to the device, corresponding to typing a key or clicking the screen.


例子:

   for i in range(200):
    device.touch(100,600,"DOWN_AND_UP")
    MonkeyRunner.sleep(5)
    device.touch(240,750,"DOWN")
    MonkeyRunner.sleep(5)
    device.touch(400,750,"UP")
    MonkeyRunner.sleep(5)



原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 娄底住房公积金查询 住房公积金查询余额 贵港住房公积金查询 东莞市住房公积金管理中心 住房公积金网站 广州住房公积金查询 河南省住房公积金查询 福州住房公积金管理中心 常州住房公积金查询 遂宁市住房公积金管理中心 天津市住房公积金管理中心 湖南住房公积金查询个人账户 深圳住房公积金电话 住房公积金查询网 洛阳住房公积金 呼和浩特住房公积金查询 青海省住房公积金查询 郑州住房公积金管理中心 苏州住房公积金查询 成都住房公积金查询个人账户 住房公积金中心电话 昆山住房公积金管理中心 吉林市住房公积金查询 沈阳住房公积金 沈阳住房公积金管理中心 贵港市住房公积金管理中心 萍乡住房公积金查询 郑州市住房公积金 赣州市住房公积金管理中心 济南住房公积金查询 济宁市住房公积金个人查询 西安住房公积金查询网 西安市住房公积金中心 西安市住房公积金 西安市住房公积金管理中心 西安市个人住房公积金查询 个人住房公积金查询个人账户 西安住房公积金个人帐户查询 住房公积金账户 查询住房公积金个人账户余额 怎么查询住房公积金