【Appium踩坑】Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code

博客内容涉及了一个iOS设备自动化测试中遇到的问题,即WebDriverAgentRunner未能启动导致测试会话创建失败。错误信息提示需遵循Appium的xcuitest-driver教程,并考虑从设备上移除并重新安装WebDriverAgentRunner应用,同时重启设备。解决方案是成功启动WebDriverAgentRunner以进行自动化测试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

解决

原因其实是没有启动 WebDriverAgentRunner,
解决就是启动 WebDriverAgentRunner 就行了。
在这里插入图片描述

详细报错
Failed to create session. 
An unknown server-side error occurred while processing the command. Original error: 
Unable to launch WebDriverAgent because of xcodebuild failure: 
xcodebuild failed with code 65 xcodebuild error message: 
. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. 
Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.

2022-06-15 17:13:50:783 - [debug] [W3C] Encountered internal error running command: Error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65
2022-06-15 17:13:50:783 - [debug] [W3C] xcodebuild error message:
2022-06-15 17:13:50:784 - [debug] [W3C] . Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
2022-06-15 17:13:50:784 - [debug] [W3C]     at quitAndUninstall (/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:585:15)
2022-06-15 17:13:50:784 - [debug] [W3C]     at /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:620:11
2022-06-15 17:13:50:784 - [debug] [W3C]     at wrapped (/usr/local/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:60:13)
2022-06-15 17:13:50:784 - [debug] [W3C]     at retry (/usr/local/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:43:13)
2022-06-15 17:13:50:784 - [debug] [W3C]     at retryInterval (/usr/local/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:70:10)
2022-06-15 17:13:50:784 - [debug] [W3C]     at /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:600:7
2022-06-15 17:13:50:798 - [HTTP] <-- POST /wd/hub/session 500 15595 ms - 1213
### 可能的原因分析 此问题通常发生在尝试通过 Appium 或其他工具启动 WebDriverAgent (WDA) 的过程中。以下是可能导致该错误的一些常见原因及其解决方案: #### 1. Xcode 配置不正确 如果 Xcode 中的项目配置存在问题,则可能会导致 WDA 构建失败。例如,缺少签名证书或团队 ID 设置不当[^1]。 #### 2. 设备连接异常 当目标设备未被正确识别或者 USB 连接不稳定时,也可能引发此类错误。确保测试设备已成功连接到 Mac 并且可以正常访问[^2]。 #### 3. WebDriverAgent 版本兼容性 使用的 WebDriverAgent 版本可能与当前环境(如 iOS 和 macOS 版本)存在不匹配情况。建议更新至最新稳定版本并重新安装依赖项[^3]。 #### 解决方案示例代码 下面提供一段用于验证和修复部分典型设置问题的小型脚本作为参考: ```bash #!/bin/bash # 定义变量 DERIVED_DATA_PATH="./DerivedData" BUNDLE_ID="com.example.wda" # 清理旧数据 rm -rf $DERIVED_DATA_PATH # 启动 WebDriverAgentRunner 测试套件 xcodebuild build test \ -project WebDriverAgent.xcodeproj \ -scheme WebDriverAgentRunner \ -destination 'id=<device_udid>' \ -derivedDataPath $DERIVED_DATA_PATH \ CODE_SIGNING_REQUIRED=NO \ CODE_SIGN_ENTITLEMENTS=NO \ CODE_SIGN_IDENTITY="" \ SKIP_INSTALL=YES \ BUILD_LIBRARY_FOR_DISTRIBUTION=YES || exit 1 echo "WebDriverAgent 已成功部署!" ``` 注意:需替换 `<device_udid>` 为实际物理设备唯一标识符以及调整 `BUNDLE_ID` 来适配具体应用场景[^4]。 --- ###
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值