from appium import webdriver
from filetools.appiumtools import find_element
import time
desired_caps = {}
desired_caps['platformName'] = 'Android' # 打开什么平台的app,固定的 > 启动安卓平台
desired_caps['platformVersion'] = '7.1.2' # 安卓系统的版本号:adb shell getprop ro.build.version.release
desired_caps['deviceName'] = 'V1923A' # 手机/模拟器的型号:adb shell getprop ro.product.model
desired_caps['appPackage'] = 'com.tencent.mobileqq' # app的名字:
# 安卓8.1之前:adb shell dumpsys activity | findstr "mFocusedActivity"
# 安卓8.1之后:adb shell dumpsys activity | findstr "mResume"
desired_caps['appActivity'] = '.activity.SplashActivity' # 同上↑
desired_caps['unicodeKeyboard'] = True # 为了支持中文
desired_caps['resetKeyboard'] = True
desired_caps['noReset'] = True #使用app缓存
# 去打开app,并且返回当前app的操作对象
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
time.sleep(5)
driver.tap([(67,98)], 5) # 点击屏幕坐标为(x=67,y= 98)