滑動,就是一個點移動另一個點。
用法:
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)
"""
獲取手機分辨率
$ width = driver.get_window_size()['width'] #獲取寬度
$ height = driver.get_window_size()['height'] #獲取高度
屏幕左滑
$ driver.swipe(height/4*3,width/2,height/4,width/2,800)
屏幕右滑
$ driver.swipe(height/4,width/2,height/4*3,width/2,800)
屏幕下滑
$ driver.swipe(height/2,width/4,height/2,width/4*3,800)
屏幕上滑
$ driver.swipe(height/2,width/4*3,height/2,width/4,800)
本文作者原創(chuàng),禁止轉(zhuǎn)載救军。