QCkiss 2020-04-08
1、swip滑动事件
从一个坐标位置滑动到另一个坐标位置,只能是两个点之间的滑动
方法:swipe(start_x, start_y, end_x, end_y, duration=None)
参数:
1.start_x:起点X轴坐标
2.start_y:起点Y轴坐标
3.end_x: 终点X轴坐标
4.end_y,: 终点Y轴坐标
5.duration: 滑动这个操作一共持续的时间长度,单位:ms实现:driver.swipe(31,900,31,195,duration=None) 从(31.,900)滑到(31,195)2、scroll滑动事件 从一个元素滑动到另一个元素,直到页面自动停止 方法:scroll(origin_el, destination_el)参数:
1.origin_el:滑动开始的元素
2.destination_el:滑动结束的元素实现:由应用滑动到蓝牙 origin_el=driver.find_element_by_xpath("//*[contains(@text,‘应用‘)]") destination_el=driver.find_element_by_xpath("//*[contains(@text,‘蓝牙‘)]")driver.scroll(origin_el, destination_el)3、drag拖拽事件
从一个元素滑动到另一个元素,第二个元素替代第一个元素原本屏幕上的位置
方法:drag_and_drop(origin_el, destination_el)
参数:
1.origin_el:滑动开始的元素
2.destination_el:滑动结束的元素实现:由应用滑动到蓝牙 origin_el=driver.find_element_by_xpath("//*[contains(@text,‘应用‘)]") destination_el=driver.find_element_by_xpath("//*[contains(@text,‘蓝牙‘)]")driver.drag_and_drop(origin_el, destination_el)
4、应用置于后台事件
APP放置后台,模拟热启动
方法:background_app(seconds)
参数:
1.seconds:停留在后台的时间,单位:秒 实现 设置置于后台5s在展示在前台:driver.background_app(5)