错误:所需功能必须包含适用于iOS的app或bundleId

时间:2017-05-17 16:26:49

标签: ios appium-ios

我使用的是mac OS X 10.12,Appium服务器1.5.3,xcode版本8.3。如果我运行医生,那么它显示appium已正确安装。

info AppiumDoctor ### Diagnostic starting ###
info AppiumDoctor  ✔ Xcode is installed at: /Applications/Xcode.app/Contents/Developer
info AppiumDoctor  ✔ Xcode Command Line Tools are installed.
info AppiumDoctor  ✔ DevToolsSecurity is enabled.
info AppiumDoctor  ✔ The Authorization DB is set up properly.
info AppiumDoctor  ✔ The Node.js binary was found at: /usr/local/bin/node
info AppiumDoctor  ✔ HOME is set to: /Users/nishamendon
info AppiumDoctor  ✔ ANDROID_HOME is set to: /Users/nishamendon/Library/Android/sdk
info AppiumDoctor  ✔ JAVA_HOME is set to: /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
info AppiumDoctor  ✔ adb exists at: /Users/nishamendon/Library/Android/sdk/platform-tools/adb
info AppiumDoctor  ✔ android exists at: /Users/nishamendon/Library/Android/sdk/tools/android
info AppiumDoctor  ✔ emulator exists at: /Users/nishamendon/Library/Android/sdk/tools/emulator
info AppiumDoctor ### Diagnostic completed, no fix needed. ###
info AppiumDoctor 
info AppiumDoctor Everything looks good, bye!
info AppiumDoctor 

但是,如果我启动appium服务器,并且我尝试启动检查器,则会收到错误,无法使用以下日志启动Inspector。

    [iOS] Error: The desired capabilities must include either an app or a bundleId for iOS
    at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
    at IosDriver.validateDesiredCaps (lib/driver.js:409:14)
    at IosDriver.callee$0$0$ (lib/basedriver/commands/session.js:14:8)
    at tryCatch (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at invoke (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    at enqueueResult (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:185:17)
    at Promise.F (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/$.export.js:30:36)
    at AsyncIterator.enqueue (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:184:12)
    at AsyncIterator.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at Object.runtime.async (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:209:12)
    at IosDriver.callee$0$0 [as createSession] (lib/basedriver/commands/session.js:8:46)
    at IosDriver.createSession$ (lib/driver.js:40:16)
    at tryCatch (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at invoke (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    at enqueueResult (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:185:17)
    at Promise.F (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/$.export.js:30:36)
    at AsyncIterator.enqueue (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:184:12)
    at AsyncIterator.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at Object.runtime.async (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:209:12)
    at IosDriver.createSession (lib/driver.js:110:19)
    at AppiumDriver.createSession$ (lib/appium.js:121:43)
    at tryCatch (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at invoke (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    at enqueueR
esult (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:185:17)
    at Promise.F (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/$.export.js:30:36)
    at AsyncIterator.enqueue (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:184:12)
    at AsyncIterator.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at Object.runtime.async (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:209:12)

3 个答案:

答案 0 :(得分:1)

发生再生器错误,因为xCode 8仅适用于appium 1.6 +。

您可以参考:https://github.com/appium/appium/issues/6845

答案 1 :(得分:1)

为应用路径添加所需的功能(例如) DesiredCapabilities.setCapability(" app"," /Users/Library/Developer/Xcode/DerivedData/foldername/Build/Products/Debug-iphoneos/appname.app");

此外,您可以通过打开appium GUI打开app.3的appium检查器,选择iOS图标并点击检查器图标(不要在启动appium后点击GUI中的#39;) 1.6+)终端服务器。
请参阅:https://discuss.appium.io/t/how-to-launch-appium-inspector-on-appium-1-6-0-beta2-as-there-is-no-appium-app-file-for-that-beta/12448/16

答案 2 :(得分:0)

你需要添加能力" app"或者" bundleId"。因为在你的情况下,它无法知道它应该启动哪个应用程序。

capabilities.setCapability("app","path of your .app file");

Appium 1.5.3与xcode 8+不兼容。如果您已经通过终端安装了appium,则通过运行该命令启动appium到终端。

appium

此命令将启动appium server.Don不使用appium 1.5.3。

请参阅以下链接,了解如何在安装appium 1.6 +

后从终端启动并运行appium

Launch and run appium in Mac