tap用法
1.tap是模拟手指点击页面上元素
语法有两个参数,第一个是positions,是list类型最多五个点,duration是持续时间,单位毫秒
tap(self, positions, duration=None): Taps on an particular place with up to five fingers, holding for a certain time 模拟手指点击(最多五个手指),可设置按住时间长度(毫秒) :Args: - positions - list类型,里面对象是元组,最多五个。如:[(100, 20), (100, 60)] - duration - 持续时间,单位毫秒,如:500 :Usage: driver.tap([(100, 20), (100, 60), (100, 100)], 500)
坐标定位
#coding= utf-8from appium import webdriver desired_caps = { ‘platformName‘:"Android", ‘deviceName‘:"R8V5T15930002010", ‘platformVersion‘:"5.0.1", ‘appPackage‘:"com.yuedan", ‘appActivity‘:"com.yuedan.ui.Activity_Splash", } driver = webdriver.Remote(‘http://127.0.0.1:4723/wd/hub‘, desired_caps) # 点登录 driver.tap([(781,1513),(1022,1648)], 500)