Appium 基础API

滑动

 1 #获取App大小
 2 size = driver.get_window_size()
 3 
 4 #获取宽和高
 5 height = size.get('height')
 6 width = size.get('width')
 7 
 8 #计算滑动位置的高度
 9 x1 = x2 = width * 0.5
10 y1 = height * 0.9
11 y2 = height * 0.2
12 
13 #滑动屏幕
14 driver.swipe(x1,y1,x2,y2)

 

操作APP的API

 1 #判断某个app是否被安装,接收参数:包名
 2 driver.is_app_installed('com.tencent.mobileqq')
 3 
 4 #卸载APP,接收参数:包名
 5 driver.remove_app('com.tencent.mobileqq')
 6 
 7 #安装app
 8 driver.install_app('c://com.tencent.mobileqq')
 9 
10 #关闭初始化的app,这种时候驱动没有被关闭
11 driver.close_app()
12 #启动初始化app
13 driver.launch_app()
14 
15 #当前的activity
16 driver.current_activity
17 
18 #启动多个app
19 driver.start_activity('包名','activityName')
20 
21 #将APP退出到桌面,5秒后再启动
22 driver.background_app(5)
23 
24 #调用就初始化
25 driver.reset()

 

posted @ 2019-03-14 11:34  年轻小阿姨  阅读(117)  评论(0编辑  收藏  举报