Appium作为当下一款移动应用的自动化测试工具,对于测试来说重要性不言可寓,废话不多说,下面总结下它常用的API:

1.contexts
contexts(self):
  Returns the contexts within the current session .
  返回当前会 话中的上下文 ,使用后可以识别H5 的控件
  Usage:
  driver.contexts

2.scroll
scroll(self, origin_el, destination_el):
  Scrolls from one element to another
  从元素 origin_el滚动元素 destination_el
  Args:
  - originalEl - the element from which to being
  scrolling
  - destinationE1- the element to scroll to
  Usage:
  driver.scroll(el1, el2)

3.drag_and_drop
drag_and_drop(self, origin_el, destination_el):
  Drag the origin element to the destination element
  将元素origin_el拖到目标元素 destination_el
  Args:
  - originEl - the element to drag
  - destinationE1- the element to drag to
  Usage:

  driver.drag_and_drop(el1,el2)

4.tap

tap(self, positions, duration=None):
  Taps on an particular place with up to five fingers, holding for a certain time
  模拟手指点击 最多五个手指,时间为毫秒
  :Args:
  - positions - an array of tuples representing the x/y coordinates of the fingers to tap. Length can be up to five.
  - duration - (optional) length of time to tap, in ms
  Usage:

  driver.tap([(x,y),(x1,y1)],500)

5.swipe
swipe(self, start_x, start_y, end_x, end_y, duration=None):
  Swipe from one point to another point, for an optional duration.
  从A点滑动 B点 滑动,时间为毫秒
  Args:

  - start_x - x-coordinate at which to start
  - start_y - y-coordinate at which to start
  - end_x - x-coordinate at which to stop
  - end_y - y-coordinate at which to stop
  - duration - (optional) time to take the swipe, in ms.
  Usage:

  driver.swipe(x1,y1,x2,y2,500)
7.launch _app

launch_app(self):
  Start on the device the application specified in the desired capabilities.
  启动app
  Usage:
  driver.launch_app()

8.click

click(self):

  Clicks the element.

   点击元素

  Usage:

  element.click()

9.size

size(self):
  The size of the element.
  获取元素 的大小和高宽
  new_size["height"] = size["height"]
  new_size["width"] = size["width"]
  Usage:

  driver.element.size

10.location

location(self):
  The location of the element in the renderable canvas.
  获取取元 素的坐标
  Usage:

  driver.element.location

  driver.element.location.get('x')  ''返回element的x坐标, int 型''
  driver.element.location.get('y')  ''返回element的y坐标, int 型''

待续~
   

Appium常用API(一)的更多相关文章

  1. 7、Appium常用API

    嗯,官网已经介绍的很全了.会选几个常用API后期整理. Appium常用API地址:http://appium.io/docs/cn/writing-running-appium/appium-bin ...

  2. Appium常用API(二)

    接前面的常用API(一),本文接着介绍如下: 1.press_keycode press_keycode(self, keycode, metastate=None): Sends a keycode ...

  3. appium 常用api介绍(2)

    前言:接着上一篇继续讲常用的一些api 参考博文:http://blog.csdn.net/bear_w/article/details/50330565 1.send_keys send_keys( ...

  4. appium 常用API使用总结!

    将常用函数进行适用总结,后期在使用的过程中直接查找调用即可 获取界面属性.控件属性 1.current_activity:获取activity名称 device.current_activity 2. ...

  5. appium 常用API

    ''.appium api第二弹 锋利的python,这是初稿,2015/1/5 如有错误的地方,请同学们进行留言,我会及时予以修改,尽量整合一份ok的api 作者:Mads Spiral QQ:79 ...

  6. appium 常用api介绍(1)

    前言:android手机大家都很熟悉,操作有按键.触摸.点击.滑动等,各种操作方法可以通过api的方法来实现. 参考博文:http://blog.csdn.net/bear_w/article/det ...

  7. Appium常用Api实操

    本文是基于python语言在android上实操的,仅记录(忽略排版~~~) 会不时更新的: from appium import webdriver from selenium.webdriver. ...

  8. APPIUM 常用API介绍(3)

    1.send_keys send_keys(self, *value): Simulates typing into the element[在元素中模拟输入(开启appium自带的输入法并配置了ap ...

  9. Appium之常用API

    Appium常用API解析 1.current_activity:获取当前页面的activity名,比如com.taobao.tao.TBMainActivity 或 com.taobao.brows ...

随机推荐

  1. 线程之死锁、递归锁、信号量、事件Event 、定时器

    1.死锁的现象 所谓死锁: 是指两个或两个以上的进程或线程在执行过程中,因争夺资源而造成的一种互相等待的现象,若无外力作用,它们都将无法推进下去.此时称系统处于死锁状态或系统产生了死锁,这些永远在互相 ...

  2. 请描述一下 cookies,sessionStorage和localStorage的区别?

    cookie在浏览器和服务器间来回传递. sessionStorage和localStorage不会sessionStorage和localStorage的存储空间更大:sessionStorage和 ...

  3. sgdisk基本用法

    简介 sgdisk是Linux下操作GPT分区的工具,就像fdisk是操作MBR分区的工具.关于GPT和MBR的区别请参考: http://www.anchor.com.au/blog/2012/10 ...

  4. python json.dumps() 中文乱码问题

    python json.dumps() 中文乱码问题   python 输出一串中文字符,在控制台上(控制台使用UTF-8编码)通过print 可以正常显示,但是写入到文件中之后,中文字符都输出成as ...

  5. [js方法pk]之instanceof() vs isPrototypeOf() hasOwnProperty() vs propertyIsEnumerable()

    这几个方法在js的高级编程中经常用到,对于新手来说可能还不知道他们有什么区别,我把我的体会总结下来,供大家参考: 首先,定义一个对象: function Parent() {this.name = & ...

  6. pandas 读取excle ,迭代

    # -*-coding:utf-8 -*- import pandas as pd xls_file=pd.ExcelFile('D:\python_pro\\address_list.xlsx') ...

  7. MySQL 执行 'use databases;' 时很慢

    问题描述: 就是这么个情况,登录数据库切换库时感觉很卡,需要等待几秒钟. 案例: shell > mysql -uroot -ppassword mysql> use databases; ...

  8. ios编译出错:UIButton.h' has been modified since the precompiled header UIKit.pcm' was built

    今天编译遇到个问题:如下 fatal error: file '/Applications/Xcode 2.app/Contents/Developer/Platforms/iPhoneSimulat ...

  9. android学习-Eclipse中修改Android项目图标

    参考原文:http://blog.csdn.net/wpwbb510582246/article/details/52556753 方法一:替换res文件夹下的ic_launcher-web.png图 ...

  10. linux tar 压缩

    压缩文件 tar -czvf xxx.tar.gz yourdict 解压文件 tar xzf aa.tar.gz