51Testing软件测试论坛
标题:
appium拖放元素
[打印本页]
作者:
测试积点老人
时间:
2018-12-25 16:05
标题:
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);
复制代码
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2