无法使用 appium 1.6.0 在 IOS 10 真实设备中启动 ipa 文件

Posted

技术标签:

【中文标题】无法使用 appium 1.6.0 在 IOS 10 真实设备中启动 ipa 文件【英文标题】:Unable to launch ipa file in IOS 10 real Device using appium 1.6.0 【发布时间】:2017-03-08 20:05:15 【问题描述】:

首先我从开发团队获得了一个 .ipa 文件进行测试,开发人员提到了带有设备 UDID 的 .ipa 文件,以便我可以将它安装到我的 iPhone 上。

[Appium] Welcome to Appium v1.6.0
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> POST /wd/hub/session "capabilities":"desiredCapabilities":"app":"/Users/apple/Downloads/ReaderManager.ipa","noReset":true,"platformVersion":"10.0","bundleId":"com.hidglobal.pacs.se.readermanager","platformName":"ios","udid":"1f51471daf2a4674f11ece1a19d6cb4fa5569c02","deviceName":"iPhone 6","requiredCapabilities":,"desiredCapabilities":"app":"/Users/apple/Downloads/ReaderManager.ipa","noReset":true,"platformVersion":"10.0","bundleId":"com.hidglobal.pacs.se.readermanager","platformName":"iOS","udid":"1f51471daf2a4674f11ece1a19d6cb4fa5569c02","deviceName":"iPhone      6","requiredCapabilities":    
[debug] [MJSONWP] Bad parameters: BadParametersError: Parameters were incorrect. We wanted "required":["desiredCapabilities"],"optional":["requiredCapabilities","sessionId","id"] and you sent ["capabilities","desiredCapabilities","requiredCapabilities"]
[HTTP] <-- POST /wd/hub/session 400 6 ms - 201 
[HTTP] --> POST /wd/hub/session "desiredCapabilities":"app":"/Users/apple/Downloads/ReaderManager.ipa","noReset":true,"platformVersion":"10.0","bundleId":"com.hidglobal.pacs.se.readermanager","platformName":"iOS","udid":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","deviceName":"iPhone 6","requiredCapabilities":
[MJSONWP] Calling AppiumDriver.createSession() with args: ["app":"/Users/apple/Downl...
[Appium] Requested iOS support with version >= 10, using XCUITest driver instead of UIAutomation-based driver, since the latter is unsupported on iOS 10 and up.
[Appium] Creating new XCUITestDriver session
[Appium] Capabilities:
[Appium]   app: '/Users/apple/Downloads/xyz.ipa'
[Appium]   noReset: true
[Appium]   platformVersion: '10.0'
[Appium]   bundleId: 'xxxxxxxx'(Changed Manually)
[Appium]   platformName: 'iOS'
[Appium]   udid: 'xxxxxxxxxxxxxxxxxxxxx'(Changed Manually)
[Appium]   deviceName: 'iPhone 6'
[debug] [XCUITest] XCUITestDriver version: 2.0.26
[BaseDriver] Session created with session id: f1a2a222-8e4f-47fb-bbbd-2429f159b403
[debug] [XCUITest] Xcode version set to '8.0'
[debug] [XCUITest] iOS SDK Version set to '10.0'
[debug] [XCUITest] Available devices: xxxxxxxxxxxxxx
[debug] [XCUITest] Creating iDevice object with udid xxxxxxxxxxxxxxxxxxx
[XCUITest] Determining device to run tests on: udid: 'xxxxxxxxxxxxxxxxx',     real device: true
[BaseDriver] Using local app '/Users/apple/Downloads/ReaderManager.ipa'
[debug] [BaseDriver] Copying local zip to tmp dir
[debug] [BaseDriver] Unzipping /var/folders/2d/qg1847_14nd90zgq9_m30zhc0000gn/T/2016926-3576-bfkmhz.8l1yycik9/appium-app.zip
[debug] [BaseDriver] Testing zip archive: /var/folders/2d/qg1847_14nd90zgq9_m30zhc0000gn/T/2016926-3576-bfkmhz.8l1yycik9/appium-app.zip
[BaseDriver] Unzipped local app to '/var/folders/2d/qg1847_14nd90zgq9_m30zhc0000gn/T/2016926-3576-bfkmhz.8l1yycik9/Payload/ReaderManager.app'
[debug] [XCUITest] Checking whether app is actually present
[debug] [iOSLog] Attempting iOS device log capture via libimobiledevice idevicesyslog
[debug] [iOSLog] Found idevicesyslog: '/usr/local/bin/idevicesyslog'
[XCUITest] Setting up real device
 [debug] [XCUITest] Stdout from app isInstalled check: [....] Waiting for iOS device to be connected
[....] Using iPhone 6 (GSM) 'Iphone 6' (xxxxxxxxxxxxxxx).
true
[debug] [XCUITest] App is installed.
[debug] [XCUITest] Full reset not requested. No need to install.
[XCUITest] Using default agent:     /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj
[XCUITest] Using default bootstrap: /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
[XCUITest] Launching WebDriverAgent on the device
[debug] [XCUITest] Carthage found: /usr/local/bin/carthage
[debug] [XCUITest] Beginning test with command '/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/bin/run-xcodebuild.sh --project /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj --scheme WebDriverAgentRunner --destination id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' in directory '/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent'
[XCUITest] Waiting for WebDriverAgent to start on device
   [XCUITest] The real device logger 'idevicesyslog' was unable to start log capture. Please try installing 'deviceconsole' ('npm install -g deviceconsole') and specify the path to it using the 'realDeviceLogger' capability.
[debug] [XCUITest] Log file for xcodebuild test: /Users/apple/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/5D3AF14D-B012-422A-B281-1F3CE59A49EA/Session-WebDriverAgentRunner-2016-10-26_150854-8VLGgF.log
[Xcode] 2016-10-26 15:08:58.437 xcodebuild[3594:21573] Error Domain=IDETestOperationsObserverErrorDomain Code=3 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /Users/apple/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/5D3AF14D-B012-422A-B281-1F3CE59A49EA/Session-WebDriverAgentRunner-2016-10-26_150854-8VLGgF.log" UserInfo=NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /Users/apple/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/5D3AF14D-B012-422A-B281-1F3CE59A49EA/Session-WebDriverAgentRunner-2016-10-26_150854-8VLGgF.log
[Xcode] Code signing is required for product type 'UI Testing Bundle' in SDK 'iOS 10.0'
[Xcode] Signing for "WebDriverAgentRunner" requires a development team. Select a development team in the project editor.enter code here
[Xcode] Code signing is required for product type 'UI Testing Bundle' in SDK 'iOS 10.0'

在执行脚本期间,我遇到了上述问题。

请求团队帮助我确定问题以及如何解决它。

谢谢, 古瑟姆

【问题讨论】:

您是否在您的真实设备中安装了 WebDriverAgent,您需要同时签署 WebDriverAgent 和您的应用应该具有相同的临时配置文件。 我应该知道从哪里可以获得 WebDriverAgent。 @sai 如果您是通过命令行安装的,我相信您确实需要检查此路径下的 Appium 文件夹以找到 WebDriverAgent 项目 > AppiumFolder/non_modules/appium-xcuitest-driver/WebDriverAgent 哪里可以在真实设备上运行测试?我在做同样的事情时遇到了麻烦 【参考方案1】:

    在终端中运行以下命令打开 WebDriverAgent 项目。

     Open usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj
    

    现在这将在 xcode 中打开 WebDriverAgent 项目。

    如下图所示进入项目的构建设置并添加开发团队。

    如果开发团队中没有可供选择的选项,请按照以下步骤添加帐户。

    一个。单击 xcode 并导航到首选项。 湾。点击帐户。 C。单击“+”符号并添加与代码签名活动所用帐户相同的帐户。

    现在您可以在开发团队中选择添加的帐户。

    为开发团队选择的帐户应与为代码签名活动选择的帐户相同。

    现在同样通过导航到构建设置来为所有目标添加开发团队。

    运行代码检查是否有任何错误,应该会显示构建成功的消息。

请同时参考 Bluedev 的评论。

【讨论】:

我已经尝试了所有这些,并且构建了没有错误的 WebDriverAgent 项目,但是当我尝试运行测试时,我收到错误:处理命令时发生未知的服务器端错误。原始错误:未知设备或模拟器 UDID:'20a548dc87a87ecddf7ab3975a4b5f3395ac1a0' 链接到我的问题:***.com/questions/40510858/… 您可以尝试删除 udid。因为您在模拟器中运行,所以不需要 UDID,因为您提供设备名称,ios 版本 我喜欢在真实设备上运行测试,因此我添加了设备的 UDID。请指教。 请注意,在brew install appium 之后,我们设法在此路径中找到了 Webdriveragent 的 xcodeproj:/usr/local/Cellar/appium/1.21.0/libexec/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj 这对我有用,但我做了一些不同的事情:在项目级别WebDriverAgent &gt; Build Settings &gt; Signing &gt; Code Signing Identity)我每个下拉到“Apple Development”在每个签名目标 我已经选择了我的开发团队(不是个人团队,而是我的公司团队) 在上述步骤之后,我的测试在物理设备上成功开始。谢谢@SaiPawan 的提示!【参考方案2】:

如果您在创建开发团队并在 Xcode 中构建应用后仍无法执行 appium 脚本..

按照下面链接中给出的步骤并尝试在这些步骤之后运行 appium,我尝试了它(注意:有一些无法想象的库缺少安装:)并为我工作。我有 Mac OS 10.12.5 和 Appium 版本 1.6.5。希望这会有所帮助。

Appium Setup for running on real and emulated devices

【讨论】:

以上是关于无法使用 appium 1.6.0 在 IOS 10 真实设备中启动 ipa 文件的主要内容,如果未能解决你的问题,请参考以下文章

无法使用适用于 iOS 混合应用程序的 appium 检查作为背景图像存在的元素

无法在真实设备上使用 Appium 在 iOS hyprid 应用程序自动化中识别 WEBVIEW 中的元素

无法使用 Appium 为 IOS 生成的代码运行量角器脚本,它说 findelement 不是函数

当我们使用 appium 重新启动应用程序时,无法在 ios 11.2 中限制应用程序重置数据

无法在appium iOS测试上滑动

自 xCode 13 和 iOS 15 以来,Appium(和桌面)无法启动 wda 会话