def getSize(): #获取当前的width和height的x、y的值
x = driver.get_window_size()[‘width‘] #width为x坐标
y = driver.get_window_size()[‘height‘] #height为y坐标
return (x, y)
def swipeUp(t): #当前向上滑动swipeup
l = getSize()
x1 = int(l[0] * 0.5)
y1 = int(l[1] * 0.75)
y2 = int(l[1] * 0.25)
driver.swipe(x1, y1, x1, y2,500) #设置时间为500
def swipLeft(t): #当前向左进行滑动swipleft
l=getSize()
x1=int(l[0]*0.75)
y1=int(l[1]*0.5)
x2=int(l[0]*0.05)
driver.swipe(x1,y1,x2,y1,500)
swipLeft(3000) #向左滑行3000
def swipeDown(t): #向下滑动swipedown
l = getSize()
x1 = int(l[0] * 0.5)
y1 = int(l[1] * 0.25)
y2 = int(l[1] * 0.75)
driver.swipe(x1, y1, x1, y2,500)
swipeDown(10000) #向下滑动10000
def swipRight(t): #向右滑行swipright
l=getSize()
x1=int(l[0]*0.05)
y1=int(l[1]*0.5)
x2=int(l[0]*0.75)
driver.swipe(x1,y1,x2,y1,500)
swipRight(3000) #向右滑行3000,回到初始位置
原文:https://www.cnblogs.com/123blog/p/12622826.html