iOS WebDriverAgent绕坑日记

关于iOS的Appium环境搭建, 有大量的坑点, 没有亲身体验过都不能算测试过iOS的自动化. 这里主要是补充几个坑点以防有人遇到.

之前已经有前辈们给出了大量的帖子讲解怎么配置环境. 这里我就引用一下小花老师的帖子:

本帖主要是在此基础上补充一些坑点的处理方法.


  1. 提示The app identifier “com.facebook.WebDriverAgentRunner” cannot be registered to your development team because it is not available. Change your bundle identifier to a unique string to try again.

因为identifier不唯一导致. 解决方法:
在项目 > Build Settings > 搜索框中搜索: Product Bundle Identifier, 将左侧列表中所有的Product Bundle Identifier修改为任意名称, 但所有的项目的名称需要一致:

修改好后, 再返回到Signing页面, 报错提示就消失了. 此时如果没有其他问题的话, 就可以选择WebDriverAngetRunner进行Build了.


  1. Xcode上编译后, 真机上没有显示WebDriverAgentRunner程序图标

具体原因不详, 解决方案:
命令行编译:

idevice_id -l   # 得到自己设备的ID
cd wda/path  # 进入到自己的wda文件夹下
xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=device id' test           # 这里的device id替换成第1步得到的id

这样就可以成功编译到真机上


  1. 编译报错: WebDriverAgent.xcodeproj Building for iOS, but the embedded framework ‘YYCache.framework’ was built for iOS + iOS Simulator

    WebDriver Agent Runner building on XCode12.3 is failed with error Building for iOS, but the linked and embedded framework ‘CocoaAsyncSocket.framework’ was built for iOS + iOS Simulator

解决方案:
Xcode中, File > Project Settings, 修改Build System 为如下配置:


(未完待续…)