Appium-desktop安装与使用

发表于:2018-7-13 11:52

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:虫师    来源:博客园

#
Appium
  项目描述:
  Appium Server and Inspector in Desktop GUIs for Mac, Windows, and Linux
  Appium移动测试中有个很重新的组件Appium-Server,它主要用来监听我们的移动设备(真机或模拟器),然后将不同编程语言编写的 appium 测试脚本进行解析,然后,驱动移动设备来运行测试。
  Appium-Server下载地址:https://bitbucket.org/appium/appium.app/downloads/
  但Appium-Server有一两年没有更新了。Windows版在2015年底止步于的 AppiumForWindows_1_4_16_1.zip
  于是,新的工具 Appium-desktop 来了! 它来继续 Appium-Server的使命,当然, Appium-Server当前仍然是可用的。
  下载与安装:
  Appium-desktop项目地址:https://github.com/appium/appium-desktop
  下载地址:https://github.com/appium/appium-desktop/releases
  根据自己的平台选择相关的包进行下载。本文以Windows为例,所以选择 appium-desktop-Setup-1.2.4.exe 文件进行下载。
  安装过程太简单了,双击 exe 文件,然后,等待安装完就好了,中间都不需要你设置任何选项。所以,这里就不贴图了。
  运行与使用:
  安装完成桌面会生成一个紫色的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()

  运行效果如上图右半部分。

上文内容不用于商业目的,如涉及知识产权问题,请权利人联系博为峰小编(021-64471599-8017),我们将立即处理。
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号