刷新功能在Appium中

时间:2017-09-14 10:07:30

标签: appium

我想验证App的刷新功能。为此,我必须执行下拉操作而不是单击刷新按钮。怎么做。我正在使用Appium。 感谢

2 个答案:

答案 0 :(得分:1)

You should not use swipe method as it is marked deprecated and will be removed any time soon Instead you should use TouchActions:

Dimension screenSize = driver.manage().window().getSize();
new TouchAction(driver)
  .press(screenSize.getWidth()/2, (int) (screenSize.height * 0.2))
  .waitAction(500)
  .press(screenSize.getWidth()/2, (int) (screenSize.height * 0.8))
  .release()
  .perform();

答案 1 :(得分:0)

以下是滑动代码:

语法:driver.swipe(startX,startY,endX,endY,duration);

driver.swipe(400, 800, 400, 200, 2000);