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)

坐标定位

Appium元素定位难点:tap坐标定位不准确

from 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)

 

相关文章:

  • 2022-01-01
  • 2022-12-23
  • 2021-11-12
  • 2021-08-24
  • 2021-09-01
  • 2022-01-16
猜你喜欢
  • 2021-06-13
  • 2021-05-04
  • 2022-12-23
  • 2021-09-14
  • 2021-10-06
  • 2020-06-20
  • 2021-09-23
相关资源
相似解决方案