python adb 模拟点击_使用adb shell 模拟点击事件

针对问题【appium无法点击到某一内容,需要使用adb去执行点击事件】

需要命令:

adb shell

adb devices

input

【input可以实现的功能】:

输入文本信息:input text xxxxx

物理按键操作:input keyevent KEYCODE_VOLUME_DOWN

点击(DOWN_UP)操作:input tap x坐标 y坐标

模拟滑动操作:input swipe x1 y1 x2 y2

模拟轨迹球操作:input roll 坐标1 坐标2

Python执行adb命令:

#coding:utf-8import osimport time

#打开应用程序adb1 = "adb shell input tap 900 1520"os.system(adb1)time.sleep(10)

#点击其中一个栏目adb2 = "adb shell input tap 150 950"os.system(adb2)time.sleep(5)

#点击其中一个栏目adb3 = "adb shell input tap 200 900"os.system(adb3)time.sleep(5)

#点击"播放"adb4 = "adb shell input tap 250 1300"os.system(adb4)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值