zoukankan      html  css  js  c++  java
  • Appium-desktop安装与使用

     Appium-desktop是什么?

    项目描述:

    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()

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

     

    如果你看不懂本文,请参考我的《Appium新手入门

    http://www.testclass.net/appium/

     

  • 相关阅读:
    多线程 wait和sleep区别
    什么是分布式系统,如何学习分布式系统
    Mybatis传多个参数(三种解决方案)
    UML中类之间的几种关系
    前缀、中缀、后缀表达式
    数据库连接池c3p0和dbcp
    代码收藏
    spark教程(12)-生态与原理
    spark教程(10)-sparkSQL
    spark教程(九)-操作数据库
  • 原文地址:https://www.cnblogs.com/fnng/p/7683427.html
Copyright © 2011-2022 走看看