appium拖放元素
拖放元素的解决方法如下,是开源中国APP增加栏目后,再比较增加栏目名称是否成功的实例://移动元素,再比较
MobileElement layoutView = (MobileElement)driver.findElement(By
.id("net.oschina.app:id/layout_tab"));
List<MobileElement> support = layoutView.findElements(By
.className("android.widget.TextView"));
MobileElement supportText1=support.get(0);
MobileElement supportText4=support.get(3);
MobileElement supportTextLast=support.get(support.size()-1);
TouchAction touchAction = new TouchAction(driver);
touchAction.press(supportText4).perform();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
touchAction.moveTo(supportText1).release().perform();
Thread.sleep(5000);
Assert.assertEquals(supportTextLast.getText(),addColumnText);
页:
[1]