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/html

1、首先明白appium1.5之后的版本才支持toast定位,因此下载最新的appiumnode

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

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

 

 

 

 

 

 

 

 

下载完成后,安装安装包便可:github

以下表示启动成功:web

2、抓到toast须要安装uiautomator2,npm安装不了时,能够先安装NPM镜像,地址:https://npm.taobao.org/npm

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

        

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

        

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

      须要放在本机   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

相关文章
相关标签/搜索