appium长按按钮

public static AndroidDriver driver;
/长按操作:waitAction的参数单位是ms/
public static void longClick(String id){
 WebElement longClick = driver.findElement(By.id(id));
 new TouchAction(driver).longPress(longClick).waitAction(1000).perform();
}
/TouchAction.class中定义/
public TouchAction waitAction(int ms) {
 TouchAction.ActionParameter action = new TouchAction.ActionParameter("wait");
 action.addParameter("ms", Integer.valueOf(ms));
 this.parameterBuilder.add(action);
 return this;

posted @ 2017-05-25 18:51  easymoneySniper  阅读(741)  评论(0编辑  收藏  举报