项目描述:android
Appium Server and Inspector in Desktop GUIs for Mac, Windows, and Linux。git
Appium移动测试中有个很从新的组件Appium-Server,它主要用来监听咱们的移动设备(真机或模拟器),而后将不一样编程语言编写的 appium 测试脚本进行解析,而后,驱动移动设备来运行测试。github
Appium-Server下载地址:https://bitbucket.org/appium/appium.app/downloads/web
但Appium-Server有一两年没有更新了。Windows版在2015年末止步于的 AppiumForWindows_1_4_16_1.zip 编程
因而,新的工具 Appium-desktop 来了! 它来继续 Appium-Server的使命,固然, Appium-Server当前仍然是可用的。app
Appium-desktop项目地址:https://github.com/appium/appium-desktop编程语言
下载地址:https://github.com/appium/appium-desktop/releases工具
根据本身的平台选择相关的包进行下载。本文以Windows为例,因此选择 appium-desktop-Setup-1.2.4.exe 文件进行下载。测试
安装过程太简单了,双击 exe 文件,而后,等待安装完就行了,中间都不须要你设置任何选项。因此,这里就不贴图了。ui
安装完成桌面会生成一个紫色的appium 图标,双击打开。
默认显示监控的 host 和 port ,这和 Appium-Server中是一致的。点击 “Start Server V 1.7.1” 按钮启动服务。
如今启动 启动你的移动设备(真机或模拟器),编写 Appium 自动化测试脚本,能够经过Appium-desktop 来运行测试了。
如下为Python + Appium-Python-Client库所编写的测试脚本。
#coding=utf-8 from appium import webdriver desired_caps = {} desired_caps['platformName'] = 'Android' desired_caps['platformVersion'] = '6.0' desired_caps['deviceName'] = 'Android Emulator' desired_caps['appPackage'] = 'com.android.calculator2' desired_caps['appActivity'] = '.Calculator' driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) driver.find_element_by_name("1").click() driver.find_element_by_name("5").click() driver.find_element_by_name("9").click() driver.find_element_by_name("delete").click() driver.find_element_by_name("9").click() driver.find_element_by_name("5").click() driver.find_element_by_name("+").click() driver.find_element_by_name("6").click() driver.find_element_by_name("=").click() driver.quit()
运行效果如上图右半部分。
若是你看不懂本文,请参考个人《Appium新手入门》