zoukankan      html  css  js  c++  java
  • 关于appium中的TouchAction的用法

    1.按压press

    开始按压一个元素或坐标点(x,y)。通过手指按压手机屏幕的某个位置。

    press(WebElement el, int x, int y)        

    比如TouchAction(driver).press(x=0,y=308).release().perform()     

    • release() 结束的行动取消屏幕上的指针。释放,相当于松手

    • Perform() 执行的操作发送到服务器的命令操作。

    2.长按控件

    longPress(WebElement el, int x, int y, Duration duration)

    开始按压一个元素或坐标点(x,y)。 相比press()方法,longPress()多了一个入参,既然长按,得有按的时间吧。duration以毫秒为单位。1000表示按一秒钟。其用法与press()方法相同。

    1.  TouchAction action = new TouchAction(driver);
    2.  action.longPress(names.get(200),1000).perform().release();
    3.  action.longPress(200 ,200,1000).perform().release();

    3.点击控件tap

    tap(WebElement el, int x, int y)

    1. TouchAction action = new TouchAction(driver);
    2.  action.tap(names.get(200)).perform().release();
    3.  action.tap(200 ,200).perform().release();

    4.移动 moveto

    moveTo(WebElement el, int x, int y)
    1. TouchAction action = new TouchAction(driver);
    2.  action.moveTo(names.get(200)).perform().release();
    3.  action.moveTo(200 ,200).perform().release();

    5.暂停 wait()

    action.wait(1000); 单位为毫秒

  • 相关阅读:
    CodeForces 543d Road Improvement
    UVA Foreign Exchange
    ZOJ 1825 Compound Words
    UVA 10125 Sumsets
    CodeForces
    32位linux(centos)下mongoDB的安装
    关于PHP 采集类
    关于微信支付零时工代码的修正方法
    微信公众号申请,微信支付全攻略 2
    简介CentOS与 Ubuntu的不同
  • 原文地址:https://www.cnblogs.com/wind666/p/10687160.html
Copyright © 2011-2022 走看看