14.appium基础--滑动操作

#获取屏幕尺寸

 def get_size():

    x = driver.get_window_size()['width']

    y = driver.get_window_size()['height']

    return x,y

#显示屏幕尺寸

l = get_size() print(l)

#向左滑动

def swipLeft():

    l = get_size()

    x1 = int(l[0]*0.9)

    y1 = int(l[1]*0.5)

    x2 = int(l[0]*0.1)

    driver.swip(x1,y1,x2,y1,1000)

#向左滑动2次

 for i in range(2):

    swipLeft() sleep(0.5)

你可能感兴趣的:(14.appium基础--滑动操作)