Tap 模拟手势点击坐标

前言:有时候元素怎么都定位不到,没办法就只能坐标定位了,不过这个坐标定位不准确,换个手机就可能定位不到了,这是一个下下策的定位方式。

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

 

转载于:https://www.cnblogs.com/guo2733/p/10619535.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值