appium升级1.6 + iOS10 +Xcode8

来源:互联网 发布:帝国小说cms源码下载 编辑:程序博客网 时间:2024/05/21 08:50

一 背景介绍

appium 1.5.x及以下的版本,使用UIAutomation对iOS端进行自动化测试;xcode8放弃了UIAutomation支持,而iOS10要使用xcode8编译适配,所以iOS10不能使用UIAutomation进行自动化测试了,故appium 1.5.x及以下的版本不能支持iOS 10的自动化测试。

为支持iOS 10自动化测试,appium发布了1.6.x,使用XCUITest(取代UIAutomation)进行自动化测试。

所以如果需要支持iOS 10自动化测试,就需升级appium到1.6.x,以下列出升级步骤。


二 自动化的两种框架和配置


Xcode
UI自动化框架
支持iOS系统
appium
重签名
Xcode
模拟器
真机
inspect
Xcode
UI自动化框架
支持iOS系统
appium
重签名
Xcode
模拟器
真机
inspect
7.3UI Automation7,8,91.5iOS打包与重签名

sudo xcode-select -switch /Applications/Xcode3.app/Contents/Developer

切换到Xcode7的版本

imeituan仓库打好的包配置在appium1.5中即可

命令行启动--appium====8.1XCUTest8,9,101.6.x

进入WebDriverAgent目录,对WebDriverAgent.xcodeproj 进行全部target的签名(一定要链接上真机)

本文3.3目录

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

 

切换到Xcode8的版本才行

imeituan仓库打完的包配置在appium1.6中即可

1.界面化的appium1.6启动

debug包下载后进行重签名:http://hyperloop.sankuai.info/apps/imeituan/detail/5963626eed11f0026778e2ae

 

2.命令行的appium1.6启动


三 升级appium至1.6.x

1.appium1.6.x 可视化界面的下载地址

网上下载即可

2.appium启动以及各种参数配置

参数配置参考:https://github.com/appium/appium-desktop

     

3.链接模拟器时参数配置:

 

4.链接真机时的参数配置


4.inspector

3.2 命令行安装appium

具体方法见:Appium 版本迁移

3.3 升级后的签名方法

参考:Appium升级1.6.X

安装WebDriverAgent的时候

(1)安装WebDriverAgent

 
cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent # appium中已经有了WebDriverAgent的源码
./Scripts/bootstrap.sh # 安装依赖与WebDriverAgent
(2)build WebDriverAgent(链接真机的时候)-生成pp文件,重签名
  • a.进入WebDriverAgent,用Xcode8打开webDriverAgent.xcodeproj
  • b.修改lib的bundleid与签名

 

  • c.修改app的bundleid与签名

 

  • d.runnner选成integrationApp

若此步骤不能签名成功,则到integrationApp&IntegrationTest中packing中修改签名,就可以在integrationApp(上图)中重签名成功

       

 

e.xcode中运行打开UITests.m文件,编译通过


在桌面生成一个没图标的WebDriverAgentRunner,点开之后不会有什么反应,这就OK了

 

安装WebDriverRunner之后,启动appium1.6即可

四 升级后的自动化case更新

4.1 app.properties修改

4.2 UI Automation中使用xpath&className定位的方式变化

xpath定位方式.& className定位方式=====持续更新中........

appium1.5
appium1.6
 className定位方法
@iOSFindBy(className ="UIAStaticText")
private List<IOSElement> seat1;
@iOSFindBy(className = "XCUIElementTypeCell")private List<IOSElement> seat1;
 xpath 
@iOSFindBy(xpath = "//UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]")private IOSElement seat;
 
@iOSFindBy(xpath = "//UIAButton[@name='立即预订']")private MobileElement submitButton;


五 遇到的问题

1.安装appium1.6.4出现的问题

解决方法

查看是否安装了gulp:gulp --version

如果未安装,则安装gulp:cnpm install -g gulp

 

安装完gulp之后,发现还有问题,提示缺少:Error: Cannot find module 'appium-gulp-plugins'

解决方法:xcode-select切换为Xcode8


 









原创粉丝点击