zoukankan      html  css  js  c++  java
  • appium 中的手势操作

    一、滑动

     driver.swipe(size["width"]*0.5, size["height"]*0.99, size["width"]*0.5, size["height"]*0.5, duration=200)
    

    press手势,move_to,release之间无需等待

    size = driver.get_window_size()
    ta = TouchAction(driver)
    width = size['width']
    height = size['height']
    ta.press(x=width*0.5, y=height*0.9).wait(100).
        move_to(x=width*0.5, y=height*0.3).
        release()
    ta.perform()
    

    二、九宫格

    三、列表滑动

    # 列表滑动
    old = None
    new = driver.page_source
    i = 0
    while new != old:
        try:
            print('查找----{}'.format(i))
            driver.find_element_by_android_uiautomator('new UiSelector().descriptionContains("做你自己,我一直暗暗对自己说。 ")')
        except:
            driver.swipe(size["width"] * 0.5, size["height"] * 0.9, size["width"] * 0.5, size["height"] * 0.3,
                         duration=200)
            time.sleep(3)
            old = new
            new = driver.page_source
            print('继续查找----{}'.format(i))
        else:
            print('找到了安全测试----{}'.format(i))
            break
        i = i + 1
    

    四、放大缩小

    from appium.webdriver.common.multi_action import MultiAction
    
    size = driver.get_window_size()
    width = size['width']
    height = size['height']
    a = TouchAction(driver)
    # 中心点向左下角滑动
    a.press(x=width*0.5, y=height*0.5).wait(100).
        move_to(x=width*0.1, y=height*0.9).
        release()
    b = TouchAction(driver)
    # 中心点向右上角滑动
    b.press(x=width*0.5, y=height*0.5).wait(100).
        move_to(x=width*0.9, y=height*0.1).
        release()
    c = MultiAction(driver)
    c.add(a,b)
    c.perform()
    

    五、tap

    厚积薄发
  • 相关阅读:
    arcims(HtmlView)开发经验总结《转》
    Oracle sequence
    ajax 简介
    PHP:路在何方?
    ArcIMS初级教程(4)
    设计开发必须收藏的资源网站
    Win2008+IIS7.0+VS2008 在测试调试网站时报错,紧急求救!
    动态生成客户端数组
    解决MySQL不允许从远程访问的方法
    MySql中delimiter的作用是什么
  • 原文地址:https://www.cnblogs.com/yr434/p/14011781.html
Copyright © 2011-2022 走看看