appium拖放元素

拖放元素的解決方法以下,是開源中國APP增長欄目後,再比較增長欄目名稱是否成功的實例:java

//移動元素,再比較
		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);
相關文章
相關標籤/搜索