锁定

锁定屏幕

# 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. 《JavaScript高级程序设计》心得笔记-----第一篇章

    第一章 JavaScript由ECMAScript.DOM.BOM组成.其中BOM功能在HTML5中有了正式的规范,使BOM的兼容性越来越高. 第二章 1.<script>属性中的asyn ...

  2. java检测端口号是否配占用

    java检测端口号是否被占用的工具类:       package com.frank.util; import java.io.IOException; import java.net.InetAd ...

  3. C++ 11 之学习总结

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

  4. 私人定制自己的linux小系统

     私人定制自己的linux小系统 一.前言    linux操作系统至1991.10.5号诞生以来,就源其开源性和自由性得到了很多技术大牛的青睐,每个linux爱好者都为其贡献了自己的一份力,不管是在 ...

  5. ASP.NET MVC局部验证及相关问题

    在上一篇“asp.net mvc常用的数据注解和验证以及entity framework数据映射”话题中,有的博友提到 ‘“同一个实体在3-4个地方会发生修改,每个修改需要验证的方式都不一样,后端就不 ...

  6. 查看linux系统版本命令

    一.查看内核版本命令: 1) [root@SOR_SYS ~]# cat /proc/version Linux version 2.6.18-238.el5 (mockbuild@x86-012.b ...

  7. Session原理简述

    Session存在的意义,估计每个用做web开发的人都是了解的,就为了解决HTTP是个无状态协议所带来的问题,不多说了.这里主要想说的是服务端与客户端是如何利用session进行交互的. Sessio ...

  8. CLR via C# 线程基础知识读书笔记

    1.线程的开销 a.线程内核对象 b.线程环境块 c.用户模式栈(1MB) d.内核模式栈 f.DLL线程连接和线程分离通知 2.线程的优先级由进程优先级和线程优先级共同组成 3.进程中所有的前台线程 ...

  9. 1094. The Largest Generation (25)

    A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level bel ...

  10. PAT IO-04 混合类型数据格式化输入(5)

    /* *PAT IO-04 混合类型数据格式化输入(5) *2015-08-01 作者:flx413 */ #include<stdio.h> int main() { int a; fl ...