zoukankan      html  css  js  c++  java
  • 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)
  • 相关阅读:
    正则表达式 \n和\r
    【转】单循环赛赛程安排算法研究
    Iterator效率
    Map获取键值
    PL/SQL语法详解(pdf)
    Iterator模式
    测试js函数的静态页面
    【转】java的一些基本概念
    Oracle 11g用户解锁
    oracle官方文档
  • 原文地址:https://www.cnblogs.com/guo2733/p/10619535.html
Copyright © 2011-2022 走看看