zoukankan      html  css  js  c++  java
  • Appium+python自动化获取toast消息(windows版)的方法

    原来用的Appium1.5.3GUI版本,那为什么升级呢?
    为了兼容最新版本的iOS10和Android7
    Xcode8升级后,将不支持使用UIAutomation,而是改为使用XCUITest了,并且Xcode8支持了iOS 10,所以变化还是很大的。开发代码都必须使用Xcode8才能编译了。Appium1.5.3不支持使用Xcode8,所以升级Appium1.6来配合测试
    Appium1.6,使用XCUITest支持iOS9.3和iOS10;使用UI Automator2支持Android。

    参考文档:http://www.automationtestinghub.com/download-and-install-appium-1-6/

    一、首先明白appium1.5以后的版本才支持toast定位,所以下载最新的appium

           下载地址:https://github.com/appium/appium-desktop/releases

          (mac下载的dmg结尾的包,windows下载exe结尾的包)

    下载完成后,安装安装包即可:

    如下表示启动成功:

    二、抓到toast需要安装uiautomator2,npm安装不了时,可以先安装NPM镜像,地址:https://npm.taobao.org/

         1. 首先执行这个命令:npm install -g cnpm --registry=https://registry.npm.taobao.org       安装cnpm(完成后如下图):

            

          2. 然后通过这个命令: cnpm install appium-uiautomator2-driver   安装uiautomator2的配置文件,如图:

            

          mac本需要自主下载两个apk,(appium-uiautomator2-server-v0.1.8.apk 、appium-uiautomator2-server-debug-androidTest.apk)

          需要放在本机   path /usr/local/lib/node_modules/appium/node_modules/appium-uiautomator2-driver/uiautomator2/  目录下面

          下载地址:https://github.com/appium/appium-uiautomator2-server/releases

         3. 需要导入的包:

             from selenium.webdriver.support.ui import WebDriverWait

             from selenium.webdriver.support import expected_conditions as EC

             from selenium.webdriver.common.by import By

         4. 代码中的配置如下:

            

            

           5. 获取toast的定位代码如下:

            

           6. 大功告成:

            

    参考的网站:

    http://www.cnblogs.com/meitian/p/7360017.html

    https://npm.taobao.org/

    https://testerhome.com/topics/6685#weixin.qq.com

    https://github.com/appium/appium-uiautomator2-server/releases

    http://blog.csdn.net/songer_xing/article/details/71272566

  • 相关阅读:
    设计模式-11-代理模式
    设计模式-10-装饰者
    设计模式-9-组合
    设计模式-8-适配器
    设计模式-7-原型模式
    设计模式-6-建造者
    设计模式-5-单例模式
    u-boot-1.1.6 设置新分区支持设备树
    u-boot-2014.10移植(8)重定位,支持NAND启动
    u-boot-2014.10移植(7)修改环境变量的存储位置
  • 原文地址:https://www.cnblogs.com/shangren/p/8191879.html
Copyright © 2011-2022 走看看