针对问题【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)