锁定

锁定屏幕

# python
driver.lock(5)

将 app 置于后台

把当前应用放到后台去

# python
driver.background_app(5)

收起键盘

收起键盘

# python
driver.hide_keyboard()

打开通知栏 (Notifications)

打开下拉通知栏 只能在 Android 上使用

# python
driver.open_notifications()

是否已经安装

检查应用是否已经安装

# python
driver.is_app_installed('com.example.android.apis')

安装应用

安装应用到设备中去

# python
driver.install_app('path/to/my.apk')

删除应用

从设备中删除一个应用

# python
driver.remove_app('com.example.android.apis')

摇晃 (Shake)

模拟设备摇晃

# python
driver.shake()

启动 Activity

在当前应用中打开一个 activity 或者启动一个新应用并打开一个 activity 。 只能在 Android 上使用

# python
driver.start_activity('com.example.android.apis', '.Foo')

当前 Activity

获取当前 activity。只能在 Android 上使用

# python
driver.current_activity
 

启动 (Launch)

根据服务关键字 (desired capabilities) 启动会话 (session) 。请注意这必须在设定 autoLaunch=false 关键字时才能生效。这不是用于启动指定的 app/activities ————你可以使用 start_activity 做到这个效果————这是用来继续进行使用了 autoLaunch=false 关键字时的初始化 (Launch) 流程的。

# python
driver.launch_app()

关闭应用

关闭应用

# python
driver.close_app();

重置 (Reset)

应用重置(相当于卸载重装应用)

# python
driver.reset()

可用上下文 (context)

列出所有的可用上下文

翻译备注:context可以理解为 可进入的窗口 。例如,对于原生应用,可用的context和默认context均为NATIVE_APP。详情可查看对混合应用进行自动化测试

# python
driver.contexts

当前上下文 (context)

列出当前上下文

# python
driver.current_context

切换到默认的上下文 (context)

将上下文切换到默认上下文

# python
driver.switch_to.context(None)

应用的字符串 (App Strings)

获取应用的字符串

# python
driver.app_strings

按键事件 (Key Event)

给设备发送一个按键事件

# python
driver.keyevent(176)

触摸动作(TouchAction) / 多点触摸动作(MultiTouchAction)

生成触摸动作的接口。这部分文档很快将会补充更多的内容进来。

# python
action = TouchAction(driver)
action.press(element=el, x=10, y=10).release().perform()

滑动(Swipe)

模拟用户滑动

# python
driver.swipe(start=75, starty=500, endx=75, endy=0, duration=800)

捏 (Pinch)

捏屏幕 (双指往内移动来缩小屏幕)

# python
driver.pinch(element=el)

放大 (Zoom)

放大屏幕 (双指往外移动来放大屏幕)

# python
driver.zoom(element=el)

滑动到 (Scroll To)

滑动到某个元素。

# python
todo: python

拉出文件 (Pull File)

从设备中拉出文件

# python
driver.pull_file('Library/AddressBook/AddressBook.sqlitedb')

推送文件(Push file)

推送文件到设备中去

# python
data = "some data for the file"
path = "/data/local/tmp/file.txt"
driver.push_file(path, data.encode('base64'))

设置

从这里你可以获取/设置 appium 的服务器设置。 想知道它如何工作,以及它支持哪些设置,请查看关于设置的文档

current_settings = driver.get_settings()
driver.update_settings({"someSetting": true})
												

Appium绑定的更多相关文章

  1. appium Capabilities的各个标签

    今天详解一下Capabilities的各个标签,以后如果用得着可以随时翻阅. General Capabilities 标签 概述 值 automationName 使用引擎 默认为Appium,其中 ...

  2. Appium原理

    Appium原理小结 Api接口调用selenium的接口,android底层用android的instrumentation(API2.3+ 通过绑定另外一个独立的selendroid项目来实现的) ...

  3. Appium官网Introduction

    英文官网:http://appium.io/introduction.html?lang=zh Appium 简介 Appium是一个开源的自动化测试工具,其支持iOS和安卓平台上的原生的,基于移动浏 ...

  4. appium 并发测试

    Android并发测试 Appium提供了在一台设备上启动多个Android会话的方案,而这个方案需要你输入不同的指令来启动多个Appium服务来实现. 启动多个Android会话的重要指令包括: - ...

  5. appium 真机测试问题 出现 instruments crashed on startup

    1.appium 真机测试的时候 instruments crashed on startup,必须在真机上打开UI Automation 在设置里: Developer->Enable UI ...

  6. (转载)中文Appium API 文档

    该文档是Testerhome官方翻译的源地址:https://github.com/appium/appium/tree/master/docs/cn官方网站上的:http://appium.io/s ...

  7. appium随笔

    目录结构如下: Test_edaike---page object设计思想 定位元素和脚本分离Images目录---用例失败截图case目录 eTestfastfood.py---定位app界面元素& ...

  8. Appium Desktop 介绍及使用

    一.AppiumDesktop介绍 1.Appium-server的图形界面.可以设置选项.启动/停止服务器.查看日志等功能:且无须提前安装Node / NPM,因为Node运行时直接与Appium ...

  9. Appium原理及版本变化细节

    Appium原理小结 Api接口调用selenium的接口,Android底层用android的instrumentation(API2.3+ 通过绑定另外一个独立的selendroid项目来实现的) ...

随机推荐

  1. eclipse中tomcat配置(待完善)

    tomcat版本:apache-tomcat-6.0.29 项目结构:     一.新建server方式 二.eclipse tomcat plugin方式   tomcat plugin方式必须保证 ...

  2. C++ 11 之学习总结

    感慨时间过的好快,C++ 11出来都5年了,现在才开始学习,但为时也不晚: 主要是网上及身边的朋友大肆宣扬C++ 11的某些优化,弄得别人心里痒痒的,所以就花了3天学习了点基本知识,相对于整个C++ ...

  3. [GeekBand] C++ 高级编程技术 (1)

    一.类型转换 class Fraction { public: explicit Fraction(int num, int den=1) : m_numerator(num), m_denomina ...

  4. 不用Unity库,利用.NET动态代理自己实现AOP

    AOP意为面向切面的程序设计,主要表现为对不同的代码逻辑进行隔离,从而降低不同业务逻辑之间的耦合性,AOP又理解为“横切”,可以在不改变原有实现的情况下,对代码进行拦截和扩展,如果原有设计像一个瓶子, ...

  5. javaScript 对json数据按key值排序

    var ajson= { "result":[ { "cid":1, "name":"aaa", "price ...

  6. Windows Server 2008 R2(x64) IIS7+PHP5(FastCGI)环境搭建

    相关软件下载: 1.PHP下载地址: http://windows.php.net/downloads/releases/php-5.4.4-nts-Win32-VC9-x86.zip 如果是win2 ...

  7. phpcms v9 源码解析(4)content模块下的index.php文件的init()方法解析

    在了解index.php中的init函数的时候,让我们先看看最开始的几行代码 1-5  第二行, defined('IN_PHPCMS') or exit('Nopermission resource ...

  8. (转)汉字转拼音HanziToPinyin

    本文转载于:http://blog.csdn.net/zhangphil/article/details/47164665 Android系统本身自带有有将汉字转化为英文拼音的类和方法.具体的类就是H ...

  9. H5不能少的功能-滑动分页

    // 滑动分页 $(window).scroll(function() {                   var mayLoadContent = $(window).scrollTop() & ...

  10. 在Web API中使用Swagger-UI开源组件(一个深坑的解决)

    介绍: Swagger-Ui是一个非常棒的Web API说明帮助页,具体详情可自行Google和百度. 官网:http://swagger.io/    GitHub地址:https://github ...