appium(1)-about appium
about appium
Introduction to Appium
Appium is an open-source tool for automating native, mobile web, and hybrid applications on iOS and Android platforms.//测试移动端应用,包括安卓和苹果平台的原生、移动web、混合应用。
- Native apps are those written using the iOS or Android SDKs.
- Mobile web apps are web apps accessed using a mobile browser (Appium supports Safari on iOS and Chrome or the built-in ‘Browser’ app on Android).
- Hybrid apps have a wrapper around a “webview” – a native control that enables interaction with web content.
Importantly, Appium is “cross-platform”: it allows you to write tests against multiple platforms (iOS, Android), using the same API. This enables code reuse between iOS and Android testsuites.//测试代码可以在安卓和苹果两个平台复用。
We use vendor-provided automation frameworks under the hood.That way, we don’t need to compile in any Appium-specific or third-party code or frameworks to your app.The vendor-provided frameworks we use are://使用系统提供的测试接口,iOS的UIAutomation和Android的UiAutomator。
- iOS 9.3 and below: Apple’s UIAutomation//appium1.5及其以前版本支持
- iOS 9.3 and up : Apple's XCUITest//appium1.6及其以后版本支持。
- Android 4.2+: Google’s UiAutomator
- Android 2.3+: Google’s Instrumentation. (Instrumentation support is provided by bundling a separate project, Selendroid)
We wrap the vendor-provided frameworks in one API, the WebDriver API. WebDriver (aka “Selenium WebDriver”) specifies a client-server protocol (known as the JSON Wire Protocol). Given this client-server architecture, a client written in any language can be used to send the appropriate HTTP requests to the server.//使用WebDriver(webdriver是web端测试时涉及到的一个协议,把客户端代码翻译成浏览器可以识别的代码)。
Appium Concepts
Client/Server Architecture
Appium is at its heart a webserver that exposes a REST API. It receives
connections from a client, listens for commands, executes those commands on a
mobile device, and responds with an HTTP response representing the result of
the command execution. The fact that we have a client/server architecture
opens up a lot of possibilities: we can write our test code in any language
that has a http client API, but it is easier to use one of the Appium client
libraries. We can put the server on a different machine than our
tests are running on. We can write test code and rely on a cloud service
like Sauce Labs to receive and interpret the commands.//cs结构,客户端和服务器端的交互遵循REST API风格,由此带来两个好处,一是客户端可以使用任意编程语言,二是服务器端与客户端可以不在一个机器上。
Session
Automation is always performed in the context of a session. Clients initiate
a session with a server in ways specific to each library,
but they all end up sending a POST /session request to the server,
with a JSON object called the ‘desired capabilities’ object. At this point
the server will start up the automation session and respond with a session ID
which is used for sending further commands.//自动化的所有操作都是在一个session基础上完成的。
Desired Capabilities
Desired capabilities are a set of keys and values (i.e.,
a map or hash) sent to the Appium server to tell the server what kind of
automation session we’re interested in starting up. There are also various
capabilities which can modify the behavior of the server during automation.
For example, we might set the platformName capability to iOS to tell
Appium that we want an iOS session, rather than an Android one. Or we might
set the safariAllowPopups capability to true in order to ensure that,
during a Safari automation session, we’re allowed to use JavaScript to open
up new windows. See the capabilities doc for the complete list of capabilities available for Appium.//一些键值对,可以决定session的类型,比如是建立一个iOS session,还是一个Android session。
Appium Server
Appium is a server written in Node.js. It can be built and installed from source or installed directly from NPM:
$ npm install -g appium
$ appium //用Node.js语言写成的一个服务端。
Appium Clients
There are client libraries (in Java, Ruby, Python, PHP, JavaScript, and C#)
which support Appium’s extensions to the WebDriver protocol.//支持多种语言。
| Language/Framework | Github Repo and Installation Instructions |
|---|---|
| Ruby | https://github.com/appium/ruby_lib |
| Python | https://github.com/appium/python-client |
| Java | https://github.com/appium/java-client |
| JavaScript (Node.js) | https://github.com/admc/wd |
| Objective C | https://github.com/appium/selenium-objective-c |
| PHP | https://github.com/appium/php-client |
| C# (.NET) | https://github.com/appium/appium-dotnet-driver |
| RobotFramework | https://github.com/jollychang/robotframework-appiumlibrary |
Appium Platform Support
iOS Requirements
- Mac OS X 10.10 or higher, 10.11.1 recommended
- XCode >= 6.0, 7.1.1 recommended
- Apple Developer Tools (iPhone simulator SDK, command line tools)
- Ensure you read our documentation on setting yourself up for iOS testing!
iOS Support
See Running on OS X: iOS for iOS requirements and setup instructions.
- Versions: 7.1, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1 and 9.2
- Devices: iPhone Simulator, iPad Simulator, and real iPhones and iPads
- Native app support: Yes, with debug version of .app (simulator), or correctly-signed .ipa (real devices). Underlying support is provided by Apple’s UIAutomation framework.
- Mobile web support: Yes, via automation of mobile Safari. For real devices, ios-webkit-remote-debugger is required, and automation of native aspects of the Safari interface is not possible. See the mobile web doc for instructions.
- Hybrid support: Yes. For real devices, ios-webkit-remote-debugger is required. See the hybrid doc for instructions.
- Support for automating multiple apps in one session: No
- Support for automating multiple devices simultaneously: No
- Support for automating vendor-provided or third-party apps: Only vendor-provided apps (Preferences, Maps, etc…), and only on the simulator
- Support for automating custom, non-standard UI controls: Minimal. You need to set accessibility information on the control which enables some basic automation.
Android Requirements
- Android SDK API >= 17 (Additional features require 18/19)
- Appium supports Android on OS X, Linux and Windows. Make sure you follow the directions for setting up your environment properly for testing on different OSes:
Android Support
See Running on OS X: Android, Running on Windows, or Running on Linux for Android requirements and setup instructions.
- Versions: 2.3 and up//支持安卓版本2.3及其以上。
- Versions 2.3 through 4.2 are supported via Appium’s bundled version of Selendroid, which utilizes Instrumentation. Selendroid has a different set of commands than the default Appium (though this is rapidly being minimized) and a different support profile. To access this automation backend, use the
automationNamecapability with the valueSelendroid. - Versions 4.2 and up are supported via Appium’s own UiAutomator libraries. This is the default automation backend.
- Versions 2.3 through 4.2 are supported via Appium’s bundled version of Selendroid, which utilizes Instrumentation. Selendroid has a different set of commands than the default Appium (though this is rapidly being minimized) and a different support profile. To access this automation backend, use the
- Devices: Android emulators and real Android devices//支持仿真机和实体机。
- Native app support: Yes//支持原生应用、移动端web应用和混合应用。
- Mobile web support: Yes (but not when using Selendroid backend). Automation is effected using a bundled Chromedriver server as a proxy. With 4.2 and 4.3, automation works on official Chrome browser or Chromium only. With 4.4+, automation also works on the built-in “Browser” app. Chrome/Chromium/Browser must already be installed on the device under test. See the mobile web doc for instructions.
- Hybrid support: Yes. See the hybrid doc for instructions.
- With default Appium automation backend: versions 4.4 and up
- With Selendroid automation backend: versions 2.3 and up
- Support for automating multiple apps in one session: Yes (but not when using the Selendroid backend)//在一个session可以操作多个应用。
- Support for automating multiple devices simultaneously: Yes, though Appium must be started using different ports for the server parameters
--port,--bootstrap-port(or--selendroid-port) and/or--chromedriver-port. See the server args doc for more information on these parameters.//通过配置不同端口号来操作多台设备。 - Support for automating vendor-provided or third-party apps: Yes (but not when using the Selendroid backend)
- Support for automating custom, non-standard UI controls: No
Difference between device and emulator
Appium on real Android devices
Hooray! There’s nothing extra to know about testing real Android devices: it works exactly the same as testing on emulators. Make sure that your device can connect to ADB and has Developer Mode enabled. For testing Chrome on a real device, you’re responsible for ensuring that Chrome of an appropriate version is installed.//测试时,真机和模拟器没啥不一样
Appium on real iOS devices
Appium has support for real device testing.//测试时,真机和模拟器太多不一样
To get started on a real device, you will need the following:
- An Apple Developer ID and a valid Developer Account with a configured distribution certificate and provisioning profile.
- An iPad or iPhone. Make sure this has been set up for development in Xcode. See this article for more information.
- A signed
.ipafile of your app, or the source code to build one. - A Mac with Xcode and the Xcode Command Line Developer Tools.
Provisioning Profile:A valid iOS Development Distribution Certificate and Provisioning Profile are necessary to test on a real device. Your app will also need to be signed. You can find information about this in the Apple documentation.
Appium will attempt to install your app using Fruitstrap, but it is often easier to pre-install your app using Xcode to ensure there are no problems (see the iOS deploy doc for more information).
Testing using Xcode 8 (including iOS 10) with XCUITest:This functionality currently depends on logging based on idevicesyslog, and port forwarding based on iProxy, both of which are part of libimobiledevice. Install it with Homebrew,
brew install libimobiledevice
Alternatively, logging can be done using deviceconsole, which is available here. To choose between them, use the desired capability realDeviceLogger, passing in the path to the logging program.
Running your tests with Appium:Once your device and app are configured, you can run tests on that device by passing the -U or --udid flag to the server or the udid desired capability, and the bundle ID (if the app is installed on the device) or the path to the .ipa or .apk file via the --app flag or the app desired capability.
Server Arguments:For example, if you are prelaunching your app and wish for Appium to force use a specific UDID, then you may use the below command:
appium -U <udid> --app <path or bundle>
This will start Appium and have Appium use the device to test the app.
Refer to the Appium server arguments page for more detail on the arguments that you can use.
Desired Capabilities:You can launch the app on a device by including the following desired capabilities in your tests:
appudid
Refer to the Appium server capabilities page for more detail on the capabilities that you can use.
Troubleshooting ideas
- Make sure UDID is correct by checking it in Xcode Organizer or iTunes. It is a long string (20+ chars).
- Make sure that you can run your tests against the Simulator.
- Double check that you can invoke your automation from Instruments.
- Make sure Instruments is not already running.
- Make sure UI Automation is enabled on your device. Settings -> Developer -> Enable UI Automation
appium(1)-about appium的更多相关文章
- Windows&Appium&Python自动化测试-Appium安装
一.安装node.js 官方下载地址为:https://nodejs.org/en/download 傻瓜式安装即可,安装完成后,CMD中运行node -v查看版本号 输入npm 出现如上图信息,表示 ...
- appium远程调用appium server
如何通过本地的代码,调用远程的server呢? 例如:我有两台电脑A(192.168.112.10)和B(192.168.112.11),那我怎么能在A执行本地脚本,但是使用B上的server呢? ...
- Appium自动化测试之Appium的安装与配置
Appium自动化测试- Appium环境的安装与配置Appium中文文档: https://github.com/appium/appium/tree/master/docs/cn Appium的安 ...
- 【Appium自学】Appium [安装包] Appium 官方文档(转发)
转发地址:https://blog.csdn.net/panyu881024/article/details/80149190 Appium国内下载地址 : http://pan.baidu.com/ ...
- Appium学习——安装appium Server
安装appium Server 下载地址:百度网盘的下载链接:https://pan.baidu.com/s/1pKMwdfX 下载后, AppiumForWindows.zip 进行解压,点击 ap ...
- Appium 自动化测试(8) -- Appium Python client -- API
最好的学习方法,就是看源码! 在 \appium\webdriver\webdriver.py ,新增了两个封装好定位安卓元素的方法,如 find_element_by_accessibility ...
- Appium 自动化测试(3)--Appium框架与流程介绍
Appium介绍 Appium是一个移动端的自动化框架,可用于测试原生应用,移动网页应用和混合型应用,且是跨平台的.可用于IOS和Android以及firefox的操作系统.原生的应用是指用andro ...
- Appium 自动化测试(7) -- Appium 服务器初始化参数设置
Desired Capabilities Desired capabilities 是一些发送给 Appium 服务器的键值对集合 (比如 map 或 hash),告诉服务器我们想要启动什么类型的自动 ...
- appium+python自动化☞appium python api大全
整理了一些常用的appium python api,供学习使用...
随机推荐
- 焦作F Modular Production Line 费用流
题目链接 题解:这道题比赛的时候,学弟说是网络流,当时看N这么大,觉得网络流没法做,实际本题通过巧妙的建图,然后离散化. 先说下建图方式,首先每个覆盖区域,只有左右端点,如果我们只用左右端点的话,最多 ...
- 微信小程序 wx.navigateTo()传参及多个参数方法
var workModeAndPriceList = res.data.data.workModeAndPriceList; //var result = JSON.stringify(workMod ...
- OceanBase数据库实践入门——手动搭建OceanBase集群
前言 目前有关OceanBase功能.案例.故事的文章已经很多,对OceanBase感兴趣的朋友都想安装一个数据库试试.本文就是分享初学者如何手动搭建一个OceanBase集群.这也是学习理解Ocea ...
- Codeforces Gym 100338C Important Roads 最短路+Tarjan找桥
原题链接:http://codeforces.com/gym/100338/attachments/download/2136/20062007-winter-petrozavodsk-camp-an ...
- Go语言:变参函数
变参函数: 函数中形式参数的数目通常是确定的,在调用的时候要依次传入与形式参数对应的所有实际参数,但是在某些函数的参数个数可以根据实际需要来确定,这就是变参函数. Go语言支持不定长变参,但是要注意不 ...
- GDB调试多线程程序
gdb有thread相关命令,如info thread(简写成info th)显示线程消息,b xx thread yy可以针对某个thread设置断点,thread xx(简写成thr xx)切换到 ...
- 解决Sophos UTM 9防火墙上的“根分区填满”问题
Resolving 'Root Partition Is Filling Up' Issue on Sophos UTM Firewall 收到“Sophos UTM 9”防火墻的“根分區填满”问题的 ...
- bootstrap3分页
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"% ...
- vue2.0 自定义 图片上传(UpLoader)组件
1.自定义组件 UpLoader.vue <!-- 上传图片 组件 --> <template> <div class="vue-uploader"& ...
- Spring的Scheme位置
org.springframework.aop.config org.springframework.contex.config org.springframework.ejb.config org. ...