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); 单位为毫秒

  • 相关阅读:
    I2C总线驱动框架详解
    Allegro封装的制作
    轮询与中断 简单分析
    SMI#、SCI#信号在OS、BIOS、EC中的中断方式(Linux)
    var
    集合元素重复问题
    子类重写父类属性和方法
    内存(转)
    DesiredSize,RenderSize&& Width ,ActualWidth
    sql select(A.B)拼接
  • 原文地址:https://www.cnblogs.com/wind666/p/10687160.html
Copyright © 2011-2022 走看看