标签:功能 pre roi androi return swipe dir wip driver
一、滑动功能的封装。
def get_size():
size=driver.get_window_size()
x=size[‘width‘]
y=size[‘height‘]
return x,y
def swipe_left(): #从右向左滑动
x1=get_size()[0]*0.85
y1=get_size()[1]*0.5
x2=get_size()[0]*0.15
sleep(3)
driver.swipe(x1,y1,x2,y1)
def swipe_right(): #从左向右滑动
x1=get_size()[0]*0.15
y1=get_size()[1]*0.5
x2=get_size()[0]*0.85
sleep(3)
driver.swipe(x1,y1,x2,y1)
def swipe_up(): #从下向上滑动
x1=get_size()[0]*0.5
y1=get_size()[1]*0.85
y2=get_size()[1]*0.15
sleep(3)
driver.swipe(x1,y1,x1,y2)
def swipe_down(): #从上向下滑动
x1=get_size()[0]*0.5
y1=get_size()[1]*0.15
y2=get_size()[1]*0.85
sleep(3)
driver.swipe(x1,y1,x1,y2)
def swipe_on(direction):
if direction ==‘up‘:
swipe_up()
elif direction ==‘down‘:
swipe_down()
elif direction ==‘left‘:
swipe_left()
else:
swipe_right()
swipe_on(‘up‘) #调用什么方法传什么值
AndroidUI自动化(python+appium)-页面滑动及初级使用
标签:功能 pre roi androi return swipe dir wip driver
原文地址:https://www.cnblogs.com/gaotiansai/p/10312046.html