测试工具 自动化 xcode mac配置python+appium--iOS版-真机(三) - xx&#34

📅 2026-11-30 👤 拼多多助力营销技巧 📂 拼多多助力2026 👁️ 525 次阅读

本节来看看真机上appium如何启动ios的app

1、安装Carthage

brew install carthage

2、安装依赖: Appium iOS真机测试依赖于中心第三方软件套件:libimobiledevice, 用homebrew安装:

brew install libimobiledevice

Appium支持真机在iOS 9.3以上版本使用Xcode 8+ 还要依赖于ios-deploy,通过npm安装:

npm install -g ios-deploy

3、 安装WebDriverAgent项目,appium一般自带了

自带:

Appium.app->右键-显示包内容->Contents,然后搜索WebDriverAgent.xcodeproj,点击在上层文件夹中显示,将新打开的文件,全部复制到一个新的文件夹中。

没自带,下载:

https://github.com/facebookarchive/WebDriverAgent

可以直接下载,也可以命令行使用git下载:

git clone https://github.com/facebookarchive/WebDriverAgent.git

下载之后进入WebdriverAgent的路径中执行:

cd WebDriverAgent

./Scripts/bootstrap.sh

4、Xcode打开项目,配置证书

配置WebDriverAgentLib,Team输入苹果账号密码

配置WebDriverAgentRunner

如图所示,会出现报错提示,进入WebDriverAgentRunner ->Build Settings设置中,找到Packaging中的选项,将其内容修改为唯一识别的字符串:

再回来看报错信息就没有了

5、Product>Destination,选择你的设备

Product>Scheme,选择WebDriverAgent

6、Product>Test,运行项目

这个时候手机上会成功安装上WebDriverAgent,首次安装需要手机上设置信任,路径为设置>通用>描述文件与设备管理,找到WebDriverAgent并设置信任

7、点击图中的图标或View>Debug Area>Activate Console可以查看控制台日志

浏览器中输入127.0.0.1:8100/status返回一串字符串则成功

如果没有返回内容,则需要做端口转发,命令行输入:

brew install libimobiledevice --HEAD

iproxy 8100 8100

再次刷新页面即加载成功

8、appium inspector中连接手机

{

"appium:platformVersion": "14.4.1",

"platformName": "iOS",

"appium:automationName": "XCUITest",

"appium:deviceName": "iPhone Xs",

"appium:bundleId": "com.xxx.xx",

"appium:udid": "xx"

}

"appium:automationName": "XCUITest",这一行可以不填

platformVersion、deviceName、udid、bundleId可以在Xcode中查看

Window>Devices and Simulators 拼多多帮助力入口

点击Open Console查看app的bundleId

运行app,在process列中找到SpringBoard, Message列中找到 Bootstrapping, bundleId 类似于com.xxxx.xxx.xxx

appium inspector中执行json,如果出现Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65,拔出USB再插上试试...,需要注意的是,必须先在Xcode中运行WebDriverAgent,再使用appium调用app。

标签: 拼多多助力网站平台 赚钱项目 拼多多助力网 首码项目 手赚APP
拼多多助力营销技巧