【Appium踩坑】xcodebuild: Unable to find a destination matching the provided destination specifier

问题现象:

1、WebdriverAgent 在 Xcode + 真机上 test 正常
2、开启 appium server 后,UI 脚本启动后提示:

[W3C][39m Encountered internal error running command:
 Error: Unable to launch WebDriverAgent because of xcodebuild failure: 
 xcodebuild failed with code 70
解决:
1、先查一下 xcodebuild failed with code 70

解决思路都是:
(1)在 Xcode 上启动WebdriverAgent,再执行
(2)升级 appium
但我本地已经是最新appium 并在真机上testing了。
应该不是一样的问题,可能有其他问题,继续查看日志。

日志里有一行:

2021-06-25 07:58:19:379 [WebDriverAgent] Output from xcodebuild will only be logged if any errors are present there. 
To change this, use 'showXcodeLog' desired capability
2、尝试增加caps “showXcodeLog”,查看详细Xcode 日志
caps['showXcodeLog']=True

继续执行 UI 脚本,出现新的报错信息了!

[W3C] Command line invocation:
      ...
[W3C] xcodebuild: error: Unable to find a destination matching the provided destination specifier:
[W3C] 		{ id:00008222-001E11D90C32223A }
[W3C] 	The requested device could not be found because no available devices matched the request.
[W3C] 	Available destinations for the "WebDriverAgentRunner" scheme:
[W3C] 		{ platform:macOS, arch:x86_64, variant:Mac Catalyst, id:46A4FF54-646C-5CD8-B468-A5240CB2A493 }
[W3C] 		{ platform:iOS, id:00008222-001A48322E32222E, name:11pro }
[W3C] 		{ platform:iOS Simulator, id:C0C7BD5B-7E0C-4647-BF54-795787136C76, OS:14.4, name:iPhone 11 }
[W3C] 		{ platform:iOS Simulator, id:D6E39731-468F-468E-875B-930A3C341A71, OS:14.4, name:iPhone 11 Pro }
[W3C] 		{ platform:iOS Simulator, id:C2D66A8F-2B7C-4E48-80CC-14C2086E3149, OS:14.4, name:iPod touch (7th generation) }
[W3C] 	Ineligible destinations for the "WebDriverAgentRunner" scheme:
[W3C] 		{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
[W3C] 		{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
[W3C] 		{ platform:macOS, variant:Mac Catalyst, name:Any Mac }. 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.
[W3C]     at quitAndUninstall (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:528:15)
[W3C]     at /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:558:11
[W3C]     at wrapped (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:35:13)
[W3C]     at retry (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:18:13)
[W3C]     at retryInterval (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:45:10)
[W3C]     at /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:538:7
[W3C] Destroying socket connection
[HTTP] <-- POST /wd/hub/session 500 73297 ms - 8303
[HTTP] 

重点在这两行:

[W3C] xcodebuild: error: Unable to find a destination matching the provided destination specifier:
[W3C] 		{ id:00008222-001E11D90C32223A }
[W3C] 	The requested device could not be found because no available devices matched the request.
[W3C] 	Available destinations for the "WebDriverAgentRunner" scheme:
[W3C] 		{ platform:macOS, arch:x86_64, variant:Mac Catalyst, id:46A4FF54-646C-5CD8-B468-A5240CB2A493 }
[W3C] 		{ platform:iOS, id:00008222-001A48322E32222E, name:11pro }

xcodebuild 执行时,找不到 id:00008222-001E11D90C32223A
但我执行的设备是 11pro 啊, id:00008222-001A48322E32222E
○| ̄|_

好叭,继续看:

> instruments -s devices
`instruments` is now deprecated in favor of 'xcrun xctrace' (see `man xctrace` for more information on its replacement)
Known Devices:
(null) [00008222-001E11D90C32223A]
11pro (14.3) [00008222-001A48322E32222E]

00008222-001E11D90C32223A 是个 null ???

换个设备连上电脑:

> instruments -s devices
`instruments` is now deprecated in favor of 'xcrun xctrace' (see `man xctrace` for more information on its replacement)
Known Devices:
XsMax (14.6) [00008222-001E11D90C32223A]
 (null) [00008222-001A48322E32222E]

嗷,懂了。
两台设备都连上电脑了,想跑 A 时会自动连接 B,想跑 B 时会自动连接 A
○| ̄|_

那现在是 2 两台设备: XsMax 和 11pro
想跑 11pro,那把 XsMax 先关机试一下:

> instruments -s devices
`instruments` is now deprecated in favor of 'xcrun xctrace' (see `man xctrace` for more information on its replacement)
Known Devices:
11pro (14.3) [00008222-001A48322E32222E]

妥了,重新执行 UI脚本,正常执行! yeah
( 嗷,另一台设备也可以重新启动了,之后就ok了

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值