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;
转载于:https://www.cnblogs.com/ITniu/p/6905442.html