self.driver.swipe(x1,y1,x2,y1,t)
當時代碼里有如上這么一句,當時源碼是這么說的:
# convenience method added to Appium (NOT Selenium 3) def swipe(self, start_x, start_y, end_x, end_y, duration=None): """Swipe from one point to another point, for an optional duration. :Args: - start_x - x-coordinate at which to start - start_y - y-coordinate at which to start - end_x - x-coordinate at which to stop - end_y - y-coordinate at which to stop - duration - (optional) time to take the swipe, in ms. :Usage: driver.swipe(100, 100, 100, 400) """
由於例子里也沒有對最后一個參數進行舉例說明,所以我一開始使用的參數為2.后來發現代碼執行后並沒有實現滑動的效果,后來baidu后有人提示說最后一個數字改為100或200.
最終問題解決。最后一個參數的作用應該是在多少毫秒內進行滑動操作。