package com.appium.util;
import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.Point;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
public class AppiumUtils {
public AndroidDriver<AndroidElement> driver;
public int width;
public int heigth;
public AppiumUtils(AndroidDriver<AndroidElement> driver){
this.driver=driver;
this.width=driver.manage().window().getSize().getWidth();
this.heigth=driver.manage().window().getSize().getHeight();
}
/**
* 如果执行滑动的方法没有报错,且也没有反应的情况下,有可能是被起始点落在了不可滑动的元素上
* 500表示毫秒
*/
public void swipeToUp(){
driver.swipe(width/2, 9*heigth/10, width/2, heigth/10, 500);
}
public void swipeToUp(int duration){
driver.swipe(width/2, 9*heigth/10, width/2, heigth/10, duration);
}
public void swipeToDown() {
driver.swipe(width/2, heigth/10, width/2, 9*heigth/10, 500);
}
public void swip
自动化-滑屏功能用例
最新推荐文章于 2022-10-17 20:32:31 发布