2017-09-14 271 views
0

我想驗證應用程序的刷新功能。爲此,我必須執行下拉操作,而不是點擊刷新按鈕。怎麼做。我正在使用Appium。 由於刷新功能在Appium

回答

0

下面是滑動代碼:

語法:driver.swipe(STARTX,startY,endX,恩迪,持續時間);

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

是得到了它。我只能向上滾動。謝謝 –

+0

如果能爲您工作,請您將此答案標記爲「已接受」。這對其他人會有幫助。 – Vinod

1

你不應該使用swipe方法,因爲它被標記deprecated,將被刪除任何時間很快 相反,你應該使用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();