t=滑动事件时间,毫秒n=次数# coidng=utf-8'''获取当前窗口长宽'''def get_size(dr): x = int(dr.get_window_size()['width']) y = int(dr.get_window_size()['height']) return x,y'''向上滑'''def swipe_up(dr,t=500,n=1): screen= get_size(dr) for i in range(n): dr.swipe(screen[0]*0.5,screen[1]*0.75,screen[0]*0.5,screen[1]*0.25,t)'''向下滑'''def swipe_down(dr,t=500,n=1): screen= get_size(dr) for i in range(n): dr.swipe(screen[0]*0.5,screen[1]*0.25,screen[0]*0.5,screen[1]*0.75,t)'''向左滑'''def swipe_left(dr,t=500,n=1): screen = get_size(dr) for i in range(n): dr.swipe(screen[0]*0.75,screen[1]*0.5,screen[0]*0.25,screen[1]*0.5)'''向右滑'''def swipe_right(dr,t=500,n=1): screen = get_size(dr) for i in range(n): dr.swipe(screen[0]*0.25,screen[1]*0.5,screen[0]*0.75,screen[1]*0.75)
swipe实现app滑动效果
点赞
收藏