TA的每日心情 | 无聊 昨天 09:38 |
---|
签到天数: 493 天 连续签到: 3 天 [LV.9]测试副司令
|
拖放元素的解决方法如下,是开源中国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);
复制代码
|
|