将学习变成乐趣,一直在路上
每天1990

导航

 
前提说明:Appium通过WebDriverAgent来操作iOS,所以需要在Appium下安装一份WebDriverAgent,并且将程序安装到iOS真机上
(如果是模拟器不需要这步骤)
 
环境:Xcode11.3
 
WebDriverAgent安装步骤
1.cd  /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
 
目录在appium安装目录下,具体路径参照自己的路径,可以通过find命令查找
可以安装appium后用其自带的WebDriverAgent,也可以直接在官网下载后自己去编译:https://github.com/facebook/WebDriverAgent 
 
2.在当前目录下执行脚本
sh ./Scripts/bootstrap.sh
 
3.编译WebDriverAgent.xcodeproj
打开当前目录下的WebDriverAgent.xcodeproj文件(工程文件在第1步的目录下)
 
注意:build时需要指定一个Development team,可以用个人Apple ID账号,生成个人证书和team(在Xcode->Preferences->Account中配置)
 
PROJECT->WebDriverAgent、TARGETS->WebDriverAgentLib和WebDriverAgentRunner的Signing使用个人的证书和Team(画黑色横线的部分)
 
TARGETS->WebDriverAgentLib和WebDriverAgentRunner的Product Bundle Identifier使用一个新名字,因为Bundle ID不能重复
 
点击Product->Build,将工程文件编译一下
 
4.测试一下,然后手机上信任证书
还是在WebDriverAgent目录下,执行下面的命令来测试一下是否生效了
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=你的udid' test
 
如果没有报错证明安装成功,同时手机上会安装一个WebDriverAgent软件
 
说明:如果编译WebDriverAgent时使用了自己的证书,需要再手机设置->通用里信任一下证书
 
测试WebDriverAgent时遇到的问题1:
Testing failed:
    Signing for "WebDriverAgentRunner" requires a development team. Select a development team in the project editor.
    Code signing is required for product type 'UI Testing Bundle' in SDK 'iOS 10.3'
需要下图的这两个target都配置一下debug的证书和配置文件,然后编译
 
测试WebDriverAgent时遇到的问题2:
Testing failed:
    Test target WebDriverAgentRunner encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted)
 
解决方法:
进入手机的设置->通用->描述文件与设备管理,信任编译WebDriverAgent时选择的证书
然后再执行该命令就可以了
 
 

 

遇到的问题:

问题1:RoutingHTTPServer/RoutingConnection.h' file not found
解决方法:进入webdriveragent下载目录,执行脚本下载依赖
cd  /Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/WebDriverAgent
sh ./Scripts/bootstrap.sh
 
问题2:Could not build module ‘RoutingHTTPServer’和'assign' property of object type may become a dangling reference;consider using 'unsafe_unretained'
环境:xcode11.3,手机ios13.5
解决方法:给手机安装的时候报错,找到报错assign的那行,将assign替换为unsafe_unretained

posted on 2017-08-14 19:28  每天1990  阅读(7534)  评论(1编辑  收藏  举报