我为Real iOS设备设置了Appium,无法启动WebDriverAgent,因为xcodebuild失败,代码为65

时间:2018-05-16 18:25:51

标签: ios xcode appium xcuitest apple-developer

我正在尝试在真正的iOS设备上运行Appium。我已经能够在android上成功运行它,但是当我尝试运行iOS时,我得到了错误。这是我的环境: -Appium v​​1.8.0 -iPhone SE 11.2.6 -Xcode 9.3.1

我读过错误65通常是由使用免费帐户引起的,但我正在为我们的开发团队使用xcodeSigningId。

我宁愿自动配置工作,但无论如何我尝试了Manuel配置,但我认为我做得不对。我按照这个网站的步骤: https://huddle.eurostarsoftwaretesting.com/how-to-set-up-appium-on-a-mac-fast-java/

此网站的此命令对我不起作用: xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination'id = af916cc5486cf9cb85ddde19f97949ecd6c62c66'test

此命令不起作用,在我为手机的uid更改id之前和之后都没有。我得到错误:“选项'目的地'至少需要一个'key = value'形式的参数”,但我不确定这个键应该来自何处或者如何格式化它。

我也试过重新加载各种依赖项,确保我没有使用sudo。这没有用。

我在下面列出了完整的Appium日志:

[Appium] Welcome to Appium v1.8.0
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> GET /wd/hub/sessions
[HTTP] {}
[MJSONWP] Calling AppiumDriver.getSessions() with args: []
[MJSONWP] Responding to client with driver.getSessions() result: []
[HTTP] <-- GET /wd/hub/sessions 200 7 ms - 40
[HTTP] 
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"appActivity":"REDACTED.LaunchActivity","automationName":"XCUITest","bundleId":"REDACTED","deviceName":"REDACTED iPhone","launchTimeout":20000,"noReset":true,"platformName":"iOS","platformVersion":"11.2.6","showXcodeLog":true,"udid":"REDACTED","xcodeOrgId":"9BKN37UJM1","xcodeSigningId":"iPhone Developer","newCommandTimeout":0,"connectHardwareKeyboard":true}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"appActivity":"REDACTED.LaunchActivity","automationName":"XCUITest","bundleId":"REDACTED","deviceName":"REDACTED iPhone","launchTimeout":20000,"noReset":true,"platformName":"iOS","platformVersion":"11.2.6","showXcodeLog":true,"udid":"REDACTED","xcodeOrgId":"9BKN37UJM1","xcodeSigningId":"iPhone Developer","newCommandTimeout":0,"connectHardwareKeyboard":true},null,null]
[BaseDriver] Event 'newSessionRequested' logged at 1526490334005 (13:05:34 GMT-0400 (EDT))
[Appium] Creating new XCUITestDriver (v2.79.3) session
[Appium] Capabilities:
[Appium] appActivity: REDACTED.LaunchActivity
[Appium] automationName: XCUITest
[Appium] bundleId: REDACTED
[Appium] deviceName: REDACTED iPhone
[Appium] launchTimeout: 20000
[Appium] noReset: true
[Appium] platformName: iOS
[Appium] platformVersion: 11.2.6
[Appium] showXcodeLog: true
[Appium] udid: REDACTED
[Appium] xcodeOrgId: 9BKN37UJM1
[Appium] xcodeSigningId: iPhone Developer
[Appium] newCommandTimeout: 0
[Appium] connectHardwareKeyboard: true
[BaseDriver] Creating session with MJSONWP desired capabilities: {"appActivity":"com....
[BaseDriver] The following capabilities were provided, but are not recognized by appium: appActivity.
[BaseDriver] Session created with session id: d25159cd-17b7-42d1-ab33-6083ab63290d
[XCUITest] Current user: 'REDACTED'
[XCUITest] Xcode version set to '9.3.1' (tools v9.3.0.0.1.1521514116)
[XCUITest] iOS SDK Version set to '11.3'
[BaseDriver] Event 'xcodeDetailsRetrieved' logged at 1526490334208 (13:05:34 GMT-0400 (EDT))
[XCUITest] Available devices: REDACTED, REDACTED
[XCUITest] Creating iDevice object with udid 'REDACTED'
[XCUITest] Determining device to run tests on: udid: 'REDACTED', real device: true
[BaseDriver] Event 'appConfigured' logged at 1526490334333 (13:05:34 GMT-0400 (EDT))
[BaseDriver] Event 'resetStarted' logged at 1526490334334 (13:05:34 GMT-0400 (EDT))
[XCUITest] Reset: fullReset not set. Leaving as is
[BaseDriver] Event 'resetComplete' logged at 1526490334334 (13:05:34 GMT-0400 (EDT))
[iOSLog] Attempting iOS device log capture via libimobiledevice idevicesyslog
[iOSLog] Starting iOS device log capture with: 'idevicesyslog'
[BaseDriver] Event 'logCaptureStarted' logged at 1526490334823 (13:05:34 GMT-0400 (EDT))
[XCUITest] Setting up real device
[XCUITest] Using WDA path: '/Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/WebDriverAgent'
[XCUITest] Using WDA agent: '/Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj'
[XCUITest] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[XCUITest] WDA is not listening at 'http://localhost:8100/'
[BaseDriver] Event 'wdaStartAttempted' logged at 1526490335360 (13:05:35 GMT-0400 (EDT))
[XCUITest] Launching WebDriverAgent on the device
[XCUITest] Carthage found: '/usr/local/bin/carthage'
[XCUITest] Killing running processes 'xcodebuild.*REDACTED, iproxy 8100' for the device REDACTED...
[XCUITest] 'pgrep -nif xcodebuild.*REDACTED' didn't detect any matching processes. Return code: 1
[XCUITest] 'pgrep -nif iproxy 8100' didn't detect any matching processes. Return code: 1
[XCUITest] Starting iproxy to forward traffic from local port 8100 to device port 8100 over USB
[XCUITest] Using Xcode 9.3.1, so fixing WDA codebase
[XCUITest] Generating xcode config file for orgId '9BKN37UJM1' and signingId 'iPhone Developer'
[XCUITest] Writing xcode config file to /var/folders/_r/0dsmcvp57ld6qh2cw41rfpb5b01q6j/T/2018416-1174-hzu0k9.6j78m/appium-temp.xcconfig
[XCUITest] Using Xcode configuration file: '/var/folders/_r/0dsmcvp57ld6qh2cw41rfpb5b01q6j/T/2018416-1174-hzu0k9.6j78m/appium-temp.xcconfig'
[XCUITest] Beginning test with command 'xcodebuild build-for-testing test-without-building -project /Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=REDACTED IPHONEOS_DEPLOYMENT_TARGET=11.2 -xcconfig /var/folders/_r/0dsmcvp57ld6qh2cw41rfpb5b01q6j/T/2018416-1174-hzu0k9.6j78m/appium-temp.xcconfig' in directory '/Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/WebDriverAgent'
[XCUITest] Output from xcodebuild will be logged. To change this, use 'showXcodeLog' desired capability
[Xcode] Build settings from command line:
[Xcode] IPHONEOS_DEPLOYMENT_TARGET = 11.2
[Xcode] 
[Xcode] 
[XCUITest] Waiting up to 60000ms for WebDriverAgent to start
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[Xcode] Build settings from configuration file '/var/folders/_r/0dsmcvp57ld6qh2cw41rfpb5b01q6j/T/2018416-1174-hzu0k9.6j78m/appium-temp.xcconfig':
[Xcode] CODE_SIGN_IDENTITY = iPhone Developer
[Xcode] DEVELOPMENT_TEAM = 9BKN37UJM1
[Xcode] 
[Xcode] 
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[Xcode] === BUILD TARGET WebDriverAgentLib OF PROJECT WebDriverAgent WITH CONFIGURATION Debug ===
[Xcode] 
[Xcode] 
[Xcode] Check dependencies
[Xcode] 
[JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[Xcode] Code Signing Error: No signing certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID "9BKN37UJM1" with a private key was found.
[Xcode] 
[Xcode] 
[Xcode] 
[Xcode] ** TEST BUILD FAILED **
[Xcode] 
[Xcode] 
[Xcode] The following build commands failed:
[Xcode] Check dependencies
[Xcode] (1 failure)
[Xcode] 
[XCUITest] Log file for xcodebuild test: /var/folders/_r/0dsmcvp57ld6qh2cw41rfpb5b01q6j/T/com.apple.dt.XCTest/IDETestRunSession-29AD789B-73D6-47D6-9F06-98DA13C08ED0/WebDriverAgentRunner-36675E5C-B052-43BE-BE0D-EE10F8069B48/Session-WebDriverAgentRunner-2018-05-16_130542-ZtN0wJ.log
[Xcode] 2018-05-16 13:05:42.541 xcodebuild[1254:44488] IDETestOperationsObserverDebug: Writing diagnostic log for test session to:
[Xcode] /var/folders/_r/0dsmcvp57ld6qh2cw41rfpb5b01q6j/T/com.apple.dt.XCTest/IDETestRunSession-29AD789B-73D6-47D6-9F06-98DA13C08ED0/WebDriverAgentRunner-36675E5C-B052-43BE-BE0D-EE10F8069B48/Session-WebDriverAgentRunner-2018-05-16_130542-ZtN0wJ.log
[Xcode] 
[Xcode] 2018-05-16 13:05:42.542 xcodebuild[1254:44485] [MT] IDETestOperationsObserverDebug: (DA8994EB-5B03-4B15-8ADD-F4241AF1ECD9) Beginning test session WebDriverAgentRunner-DA8994EB-5B03-4B15-8ADD-F4241AF1ECD9 at 2018-05-16 13:05:42.542 with Xcode 9E501 on target {
[Xcode] deviceSerialNumber: F17RH1X0H2XQ
[Xcode] identifier: REDACTED
[Xcode] deviceClass: iPhone
[Xcode] deviceName: REDACTED iPhone
[Xcode] deviceIdentifier: REDACTED
[Xcode] productVersion: 11.3
[Xcode] buildVersion: 15E216
[Xcode] deviceSoftwareVersion: 11.3 (15E216)
[Xcode] deviceArchitecture: arm64
[Xcode] deviceTotalCapacity: 12580106240
[Xcode] deviceAvailableCapacity: 6002483200
[Xcode] deviceIsTransient: NO
[Xcode] ignored: NO
[Xcode] deviceIsBusy: NO
[Xcode] deviceIsActivated: YES
[Xcode] deviceActivationState: Activated
[Xcode] isPasscodeLocked: NO
[Xcode] deviceType: 
[Xcode] supportedDeviceFamilies: (
[Xcode] 1
[Xcode] )
[Xcode] applications: (null)
[Xcode] provisioningProfiles: (null)
[Xcode] hasInternalSupport: NO
[Xcode] isSupportedOS: YES
[Xcode] developerDiskMountError: (null)
[Xcode] (null)
[Xcode] bootArgs: 
[Xcode] connected: yes
[Xcode] isWirelessEnabled: no
[Xcode] connectionType: direct
[Xcode] } (11.3 (15E216))
[Xcode] 
[Xcode] 2018-05-16 13:05:42.563 xcodebuild[1254:44485] Error Domain=NSCocoaErrorDomain Code=260 "The file “WebDriverAgentRunner-Runner.app” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/REDACTED/Library/Developer/Xcode/DerivedData/WebDriverAgent-cvqckynzuuktkogfpkkkgyompmoj/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app, NSUnderlyingError=0x7fec30966a50 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
[Xcode] 
[Xcode] 2018-05-16 13:05:42.563 xcodebuild[1254:44485] Error Domain=IDETestOperationsObserverErrorDomain Code=6 "Early unexpected exit, operation never finished bootstrapping - no restart will be attempted" UserInfo={NSLocalizedDescription=Early unexpected exit, operation never finished bootstrapping - no restart will be attempted, NSUnderlyingError=0x7fec31094440 {Error Domain=NSCocoaErrorDomain Code=260 "The file “WebDriverAgentRunner-Runner.app” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/Users/REDACTED/Library/Developer/Xcode/DerivedData/WebDriverAgent-cvqckynzuuktkogfpkkkgyompmoj/Build/Products/Debug-iphoneos/WebDriverAgentRunner-Runner.app, NSUnderlyingError=0x7fec30966a50 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}}}
[Xcode] 
[Xcode] 
[Xcode] Testing failed:
[Xcode] No signing certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID "9BKN37UJM1" with a private key was found.
[Xcode] Early unexpected exit, operation never finished bootstrapping - no restart will be attempted
[Xcode] ** TEST EXECUTE FAILED **
[Xcode] 
[Xcode] 
[XCUITest] xcodebuild exited with code '65' and signal 'null'
[Xcode] Contents of xcodebuild log file '/var/folders/_r/0dsmcvp57ld6qh2cw41rfpb5b01q6j/T/com.apple.dt.XCTest/IDETestRunSession-29AD789B-73D6-47D6-9F06-98DA13C08ED0/WebDriverAgentRunner-36675E5C-B052-43BE-BE0D-EE10F8069B48/Session-WebDriverAgentRunner-2018-05-16_130542-ZtN0wJ.log':
[Xcode] 13:05:42.542 xcodebuild[1254:44485] Beginning test session WebDriverAgentRunner-DA8994EB-5B03-4B15-8ADD-F4241AF1ECD9 at 2018-05-16 13:05:42.542 with Xcode 9E501 on target {
[Xcode] deviceSerialNumber: F17RH1X0H2XQ
[Xcode] identifier: REDACTED
[Xcode] deviceClass: iPhone
[Xcode] deviceName: REDACTED iPhone
[Xcode] deviceIdentifier: REDACTED
[Xcode] productVersion: 11.3
[Xcode] buildVersion: 15E216
[Xcode] deviceSoftwareVersion: 11.3 (15E216)
[Xcode] deviceArchitecture: arm64
[Xcode] deviceTotalCapacity: 12580106240
[Xcode] deviceAvailableCapacity: 6002483200
[Xcode] deviceIsTransient: NO
[Xcode] ignored: NO
[Xcode] deviceIsBusy: NO
[Xcode] deviceIsActivated: YES
[Xcode] deviceActivationState: Activated
[Xcode] isPasscodeLocked: NO
[Xcode] deviceType: 
[Xcode] supportedDeviceFamilies: (
[Xcode] 1
[Xcode] )
[Xcode] applications: (null)
[Xcode] provisioningProfiles: (null)
[Xcode] hasInternalSupport: NO
[Xcode] isSupportedOS: YES
[Xcode] developerDiskMountError: (null)
[Xcode] (null)
[Xcode] bootArgs: 
[Xcode] connected: yes
[Xcode] isWirelessEnabled: no
[Xcode] connectionType: direct
[Xcode] } (11.3 (15E216))
[Xcode] 13:05:42.543 xcodebuild[1254:44485] /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
[Xcode] build-for-testing
[Xcode] test-without-building
[Xcode] -project
[Xcode] /Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj
[Xcode] -scheme
[Xcode] WebDriverAgentRunner
[Xcode] -destination
[Xcode] id=REDACTED
[Xcode] IPHONEOS_DEPLOYMENT_TARGET=11.2
[Xcode] -xcconfig
[Xcode] /var/folders/_r/0dsmcvp57ld6qh2cw41rfpb5b01q6j/T/2018416-1174-hzu0k9.6j78m/appium-temp.xcconfig
[Xcode] 13:05:42.543 xcodebuild[1254:44485] Launching with Xcode.IDEFoundation.Launcher.PosixSpawn
[Xcode] 13:05:42.546 xcodebuild[1254:44485] Test standard output and standard error is at /var/folders/_r/0dsmcvp57ld6qh2cw41rfpb5b01q6j/T/com.apple.dt.XCTest/IDETestRunSession-29AD789B-73D6-47D6-9F06-98DA13C08ED0/WebDriverAgentRunner-36675E5C-B052-43BE-BE0D-EE10F8069B48/StandardOutputAndStandardError.txt
[Xcode] 13:05:42.552 xcodebuild[1254:44485] Setting up test runner session
[Xcode] 13:05:42.554 xcodebuild[1254:44485] Launch session started.
[Xcode] 13:05:42.558 xcodebuild[1254:44485] Test operation failure: Launch session expired before checking in.
[Xcode] 13:05:42.558 xcodebuild[1254:44485] _finishWithError:Error Domain=IDETestOperationsObserverErrorDomain Code=5 "Launch session expired before checking in." UserInfo={NSLocalizedDescription=Launch session expired before checking in.}
[Xcode] 
[BaseDriver] Event 'wdaStartFailed' logged at 1526490342586 (13:05:42 GMT-0400 (EDT))
[XCUITest] Unable to launch WebDriverAgent because of xcodebuild failure: "xcodebuild failed with code 65". 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.
[XCUITest] Quitting and uninstalling WebDriverAgent, then retrying
[XCUITest] Shutting down sub-processes
[XCUITest] Shutting down iproxy process (pid 1252)
[XCUITest] iproxy exited with code 'null'
[XCUITest] Removing WDA application from device
[XCUITest] Error: Unable to launch WebDriverAgent because of xcodebuild failure: "xcodebuild failed with code 65". 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.
[XCUITest] at XCUITestDriver.quitAndUninstall$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/lib/driver.js:427:13)
[XCUITest] at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[XCUITest] at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[XCUITest] at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[XCUITest] at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[XCUITest] at 
[XCUITest] Not clearing log files. Use `clearSystemFiles` capability to turn on.
[iOSLog] Stopping iOS log capture
[BaseDriver] Event 'newSessionStarted' logged at 1526490343881 (13:05:43 GMT-0400 (EDT))
[MJSONWP] Encountered internal error running command: Error: Unable to launch WebDriverAgent because of xcodebuild failure: "xcodebuild failed with code 65". 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.
[MJSONWP] at XCUITestDriver.quitAndUninstall$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/lib/driver.js:427:13)
[MJSONWP] at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/node_modules/babel-runtime/regenerator/runtime.js:67:40)
[MJSONWP] at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/node_modules/babel-runtime/regenerator/runtime.js:315:22)
[MJSONWP] at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/node_modules/babel-runtime/regenerator/runtime.js:100:21)
[MJSONWP] at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/node_modules/babel-runtime/regenerator/runtime.js:136:37)
[MJSONWP] at 
[HTTP] <-- POST /wd/hub/session 500 9884 ms - 470
[HTTP]

这么多天我一直坚持这个问题。任何帮助将不胜感激。

3 个答案:

答案 0 :(得分:2)

你得到的错误是iOS /真实设备上Appium最常见的错误。

强烈建议使用官方Appium文档iOS real device setup

博客帖子很好,但它们通常不会维护,因此可能包含过时的信息。

按照文档中的步骤操作并确保您拥有有效的 Apple开发者帐户,您需要使用它来签署WebDriverAgent。

这是最棘手的部分,如果您的帐户设置正确 - 过程进展顺利。

答案 1 :(得分:0)

事实证明,我的问题是由过期的苹果开发者证书引起的,即我之前安装过这台电脑的人。一旦我从钥匙串中删除了这个,appium就能在iOS上运行。

感谢dmle让我指向正确的方向。

答案 2 :(得分:0)

对于我的情况(appium 1.19.1iOS 14.2Xcode 12.2node v15.3.0),我通过更新WebDriverAgent.xcodeproj的签名设置(位于{ {1}},请注意路径可能会发生变化)。您必须为每个目标设置签名策略(/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent,依此类推)。您可能还必须为其选择一个IntegrationApp

基本上,这是为了使代码签名有效。

最后,不要忘了Team中的xcodeSigningId。因为您已经设置好了。