在 Mac 上搭建 Appium 环境折腾了一段时间,还是没搞定,装了 Android studio 等等环境和变量设置,使用命令 appium-doctor 查看一切都 OK 了。跑 android 的 Demo 没问题。但是跑 ios 的就出问题了不知道为啥哟,在这里问一下各位大神是否遇到过,是怎么解决的尼!
使用 appium-doctor 命令检查环境结果如下:

Appium 设置如下:

然后点击 inspection 会提示:
Could not start a new session
Be sure the Appium server is running with an application opened by using the "App Path" parameter in Appium.app (along with package and
activity for Android) or by connecting with selenium client and supplying this in the desired capabilities object.

如果直接运行 Appium Demo 也会报这个错,打印信息同点击 inspection
打印信息如下:
Appium] Creating new IosDriver session

[Appium] Capabilities:

[Appium] platformName: 'iOS'

[Appium] newCommandTimeout: '7200'

[Appium] app: ''

[Appium] platformVersion: '11.0.3'

[Appium] deviceName: 'iPhone 7'

[Appium] bundleId: 'com.xy.nuannuanliaoba'

[Appium] automationName: 'Appium'

[Appium] udid: 'bac9034744111b3a39b93a09c45fe9295cce3bd4'

[Appium] noReset: true

[Appium] showIOSLog: true

[BaseDriver] Capability 'newCommandTimeout' changed from string ('7200') to integer (7200). This may cause unexpected behavior

[BaseDriver] Session created with session id: aeab6db5-fa4c-484b-b2a6-e3273305ba39

[debug] [iOS] Not auto-detecting udid.

[debug] [iOS] Removing any remaining instruments sockets

[debug] [iOS] Cleaned up instruments socket /var/folders/fz/hmg192w9189g9v0_t_1_zwx40000gn/T/instruments_sock

[debug] [iOS] Localizable.strings is not currently supported when using real devices.

[debug] [iOS] Creating instruments

[debug] [UIAuto] Preparing bootstrap code

[debug] [UIAuto] Dynamic bootstrap dir: /Users/yunmai/Library/Application Support/appium/bootstrap

[debug] [UIAuto] Dynamic env: {"nodePath":"/Applications/Appium.app/Contents/Resources/node/bin/node","commandProxyClientPath":"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-ios-driver/node_modules/appium-uiauto/build/lib/bin/command-proxy-client.js","instrumentsSock":"/var/folders/fz/hmg192w9189g9v0_t_1_zwx40000gn/T/instruments_sock","interKeyDelay":null,"justLoopInfinitely":false,"autoAcceptAlerts":false,"autoDismissAlerts":false,"sendKeyStrategy":"grouped"}

[debug] [UIAuto] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!

[debug] [UIAuto] Dynamic bootstrap path: /Users/yunmai/Library/Application Support/appium/bootstrap/bootstrap-334104c5159cd201.js

[debug] [UIAuto] Reusing dynamic bootstrap: /Users/yunmai/Library/Application Support/appium/bootstrap/bootstrap-334104c5159cd201.js
[debug] [iOS] Reset not set, continuing

[debug] [iOSLog] Attempting iOS device log capture via libimobiledevice idevicesyslog

[debug] [iOSLog] Found idevicesyslog: '/usr/local/bin/idevicesyslog'

[debug] [iOS] Creating iDevice object with udid bac9034744111b3a39b93a09c45fe9295cce3bd4
[debug] [iOS] App is not installed. Will try to install.😟
[debug] [iOS] Real device specified but no ipa or app path, assuming bundle ID is on device
[debug] [iOS] Starting UIAutoClient, and launching Instruments.
[debug] [UIAuto] Instruments socket server started at /var/folders/fz/hmg192w9189g9v0_t_1_zwx40000gn/T/instruments_sock
[Xcode] Could not find Automation.tracetemplate in any of the followinglocations /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate,/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate
[Xcode] Could not find Automation.tracetemplate in any of the followinglocations /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate,/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate

[Xcode] Could not find Automation.tracetemplate in any of the followinglocations /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate,/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate

[MJSONWP] Encountered internal error running command: Error: Could not find Automation.tracetemplate in any of the followinglocations /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate,/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate

at getAutomationTraceTemplatePathWithoutRetry$ (lib/xcode.js:172:9)

at tryCatch (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)

at GeneratorFunctionPrototype.invoke as _invoke

at GeneratorFunctionPrototype.prototype.(anonymous function) as next

at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)

at run (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:104:47)

at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:115:28

at flush (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/$.microtask.js:19:5)

at _combinedTickCallback (internal/process/next_tick.js:67:7)

at process._tickCallback (internal/process/next_tick.js:98:9)

疑问点:
1、log 提示 [debug] [iOS] App is not installed. Will try to install
因为 app 是已经安装了的是开发打的测试包,这里提示没安装,Appium 设置里没设置路径但填了 bundle ID

备注:appium 1.7.0 版本
xcode 9.3 版本最新
jdk 1.8.0 版本


↙↙↙阅读原文可查看相关链接,并与作者交流