• appium 滑动,不使用swipe,使用新TouchAction 转载 https://blog.csdn.net/Elvis_lfc/article/details/80776945


    import java.time.Duration;


    import io.appium.java_client.TouchAction;
    import io.appium.java_client.android.AndroidDriver;
    import io.appium.java_client.touch.WaitOptions;
    import io.appium.java_client.touch.offset.PointOption;


    public class SwipeClass {
        
        static Duration duration=Duration.ofSeconds(1);
        public void swipeToUp(AndroidDriver driver) {
            int width = driver.manage().window().getSize().width;
            int height = driver.manage().window().getSize().height;
            TouchAction action1=new TouchAction(driver).press(PointOption.point(width/2, height*3/4)).waitAction(WaitOptions.waitOptions(duration))
                                    .moveTo(PointOption.point(width/2, height/4)).release();
            action1.perform();
        }


     
        public void swipeToDown(AndroidDriver driver) {
            int width = driver.manage().window().getSize().width;
            int height = driver.manage().window().getSize().height;
            TouchAction action2=new TouchAction(driver).press(PointOption.point(width/2, height/4)).waitAction(WaitOptions.waitOptions(duration))
                                    .moveTo(PointOption.point(width/2, height*3/4)).release();
            action2.perform();
        }


        public void swipeToLeft(AndroidDriver driver) {
            int width = driver.manage().window().getSize().width;
            int height = driver.manage().window().getSize().height;
            TouchAction action3=new TouchAction(driver).press(PointOption.point(width*3/4, height/2)).waitAction(WaitOptions.waitOptions(duration))
                                .moveTo(PointOption.point(width/4,height/2)).release();
           action3.perform();
        }


        public void swipeToRight(AndroidDriver driver) {
            int width = driver.manage().window().getSize().width;
            int height = driver.manage().window().getSize().height;
            TouchAction action4=new TouchAction(driver).press(PointOption.point(width / 4, height / 2)).waitAction(WaitOptions.waitOptions(duration))
                                    .moveTo(PointOption.point(width*3/4,height/2)).release();
            action4.perform();
        }


    }

  • 相关阅读:
    oracle 数据库、实例、服务名、SID
    查看oracle数据库服务器的名字
    oracle表复制
    Oracle 备份、恢复单表或多表数据步骤
    如何查询一个表中有哪些列全为空
    mysql当查询某字段结果为空并赋值
    NoSQL初探之人人都爱Redis:(1)Redis简介与简单安装
    《大型网站技术架构》读书笔记四:瞬时响应之网站的高性能架构
    《大型网站技术架构》读书笔记三:大型网站核心架构要素
    《大型网站技术架构》读书笔记二:大型网站架构模式
  • 原文地址:https://www.cnblogs.com/lixiaowei395659729/p/10063614.html
Copyright © 2020-2023  润新知