首页 > 解决方案 > 滑动磁贴不适用于动画图像

问题描述

滑动瓷砖适用于所有其他瓷砖/图像,除了像天气屏幕这样的动画图像。这是我用于滑动普通瓷砖/图像的工作代码。

public static void swipeTile(AppiumDriver driver, MobileElement element) {
    try {
           element.isDisplayed();

           int startX = Math.toIntExact(Math.round(element.getSize().getWidth())); 
           int endX = Math.toIntExact(Math.round(element.getSize().getWidth() / 2));
           int startY = element.getLocation().getY();

           TouchAction action = new TouchAction(driver);
           action.longPress(startX,startY).waitAction(500).moveTo(endX, startY).release().perform(); 
          driver.performTouchAction(action); 

    }  
    catch (Exception e) {
        e.getMessage();
    }
}

标签: javaseleniumappium

解决方案


因此,如果您已经看到他们已经是 Carousel 按钮(用于从一个图像移动到另一个图像的小圆形按钮),如果您单击它,那么您可以轻松地从一个图像跳到另一个图像,那么如果您想使用您的代码进行自动化,那么你可以分享链接,这样你就可以看到并让我们知道它是否有效

http://www.qaautomated.com/2016/02/how-to-move-seekbar-with-appium.html


推荐阅读