# appiumTest **Repository Path**: dongchao_pro/appiumTest ## Basic Information - **Project Name**: appiumTest - **Description**: Appium is an open source test automation framework for use with native and hybrid mobile apps. - **Primary Language**: Java - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2016-11-13 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #appiumTest ##Appium的特性 Appium是开源的移动端自动化测试框架 Appium可以测试原生的、混合的、以及移动端的web项目 Appium可以测试IOS,Android应用(当然了,还有Firefox OS) Appium是跨平台的,可以用在OS X,Windows以及Linux桌面系统上 ##Appium的工作原理 这个server的功能其实很简单:监听一个端口,然后接收由client发送来的command。翻译这些command,把这些command转成移动设备可以理解的形式发送给移动设备,然后移动设备执行完这些command后把执行结果返回给appium server,appium server再把执行结果返回给client。 Client /Server 工作开始是基于一个Session建立完成后开始的。也就是说,通过通过POST /session这个URL,然后传入Desired Capabilities 就可以开启session了。Server会返回一个全局唯一的session id, session id代表了你所打开的浏览器或者是移动设备的模拟器。 Desired Capabilities最重要的作用是告诉server本次测试的上下文。这次是要进行浏览器测试还是移动端测试?如果是移动端测试的话是测试android还是ios,如果测试android的话那么我们要测试哪个app? server的这些疑问Desired Capabilities都必须给予解答,否则server会拒绝,自然就无法完成移动app或者是浏览器的启动。 ##Appium client的方法 Appium client 扩展了原生的 webdriver client 方法, 比如: resetApp, getAppString, swipe, zoom, shake, launchApp 新增的 locator 比如 : findElementByIosUIAutomation, findElementByAndroidUIAutomator 这些方法主要覆盖了3大类 1. Driver 扩展 : 比如增加了 resetApp 等操作 app 的方法 2. action扩展:增加一些移动端的特有的操作,比如swipe,shake等 3. locator扩展:增加了一些移动端专属的定位策略 ##Appium 控件定位基础 人是怎么定位并操作控件的? 继承自webdriver的方法,也就是通过这3个特征可以定位控件 1. find by“class” 2. find by "xpath" 3. find by “id” 由Mobile JSON Wire Protocol 协议中定义的方法,更适合移动设备上的控件定位 1. findElementByIosUIAutomation() 2. findElementsByIosUIAutomation() 3. findElementByAndroidUIAutomator() 4. findElementsByAndroidUIAutomator() ###Appium 本地demo ###Appium 云端demo