Appium无法在模拟器中安装ipa文件。

huangapple go评论81阅读模式
英文:

Appium cannot install ipa file in simulator

问题

以下是您提供的内容的翻译:

我正在使用Appium 1.18.2版本,以下是我的能力设置,所以我尝试运行自动化脚本,但是一直出现错误,无法安装该应用程序:

DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, deviceName);
cap.setCapability(MobileCapabilityType.PLATFORM_VERSION, platformVersion);
cap.setCapability(MobileCapabilityType.PLATFORM_NAME, platformName);
cap.setCapability(MobileCapabilityType.UDID, udid);
cap.setCapability(IOSMobileCapabilityType.XCODE_ORG_ID, xcodeOrgId);
cap.setCapability(IOSMobileCapabilityType.XCODE_SIGNING_ID, xcodeSigningId);
cap.setCapability(MobileCapabilityType.APP, "/Users/fendyridwan/Documents/Project/PSA/PSA-Automation-master/PSA-PASS-P2-iOS-Automation2/file/1602589286_Pilot_Audit_Sandbox__.ipa");
// 初始化驱动程序
driver = new IOSDriver(new URL("http://127.0.0.1:" + appiumPort + "/wd/hub"), cap);
wait = new WebDriverWait(driver, 10);

以下是运行自动化脚本后出现的错误日志:

org.openqa.selenium.SessionNotCreatedException: 无法创建新的远程会话。请检查服务器日志以获取更多详细信息。原始错误: 在处理命令时发生了未知的服务器端错误。原始错误: 模拟器架构不受支持 '/var/folders/pz/vbvlmv8j3s19l6_0lxckfr_r0000gp/T/2020914-51790-1lbtz5h.uu62/PSA-iOS-Audit.app' 应用程序。请确保在Xcode中为其编译选择了正确的部署目标。

如果有人知道如何解决这个问题,请告诉我。

注:在实际设备上,我也无法使用Xcode或Appium桌面版安装ipa文件。

英文:

I am using appium 1.18.2 and here is my capabilities, so I tried to run automation script, and the error always failed to install the app:

DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, deviceName);
cap.setCapability(MobileCapabilityType.PLATFORM_VERSION, platformVersion);
cap.setCapability(MobileCapabilityType.PLATFORM_NAME, platformName);
cap.setCapability(MobileCapabilityType.UDID, udid);
cap.setCapability(IOSMobileCapabilityType.XCODE_ORG_ID, xcodeOrgId);
cap.setCapability(IOSMobileCapabilityType.XCODE_SIGNING_ID, xcodeSigningId);
cap.setCapability(MobileCapabilityType.APP, "/Users/fendyridwan/Documents/Project/PSA/PSA-Automation-master/PSA-PASS-P2-iOS-Automation2/file/1602589286_Pilot_Audit_Sandbox__.ipa");
// Initialize driver
driver = new IOSDriver(new URL("http://127.0.0.1:" + appiumPort + "/wd/hub"), cap);
wait = new WebDriverWait(driver, 10);

And here is the log of the error I got after running automation script.

org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Simulator architecture is unsupported by the '/var/folders/pz/vbvlmv8j3s19l6_0lxckfr_r0000gp/T/2020914-51790-1lbtz5h.uu62/PSA-iOS-Audit.app' application. Make sure the correct deployment target has been selected for its compilation in Xcode.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'Potatos-Mac', ip: 'fe80:0:0:0:43d:3389:bf74:843b%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.6', java.version: '1.8.0_261'
Driver info: driver.version: IOSDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Simulator architecture is unsupported by the '/var/folders/pz/vbvlmv8j3s19l6_0lxckfr_r0000gp/T/2020914-51790-1lbtz5h.uu62/PSA-iOS-Audit.app' application. Make sure the correct deployment target has been selected for its compilation in Xcode.
at getResponseForW3CError (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9)
at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:381:37)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'Potatos-Mac', ip: 'fe80:0:0:0:43d:3389:bf74:843b%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.6', java.version: '1.8.0_261'
Driver info: driver.version: IOSDriver
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:208)
at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:38)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:84)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:94)
at io.appium.java_client.ios.IOSDriver.<init>(IOSDriver.java:95)
at com.media2359.tests.BaseTest.initDriveriOS(BaseTest.java:177)
at com.media2359.tests.BaseTest.setup(BaseTest.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:458)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:142)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:168)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105)
at org.testng.TestRunner.privateRun(TestRunner.java:648)
at org.testng.TestRunner.run(TestRunner.java:505)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
at org.testng.SuiteRunner.run(SuiteRunner.java:364)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1137)
at org.testng.TestNG.runSuites(TestNG.java:1049)
at org.testng.TestNG.run(TestNG.java:1017)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:186)
... 40 more
Caused by: org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Simulator architecture is unsupported by the '/var/folders/pz/vbvlmv8j3s19l6_0lxckfr_r0000gp/T/2020914-51790-1lbtz5h.uu62/PSA-iOS-Audit.app' application. Make sure the correct deployment target has been selected for its compilation in Xcode.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'Potatos-Mac', ip: 'fe80:0:0:0:43d:3389:bf74:843b%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.6', java.version: '1.8.0_261'
Driver info: driver.version: IOSDriver
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Simulator architecture is unsupported by the '/var/folders/pz/vbvlmv8j3s19l6_0lxckfr_r0000gp/T/2020914-51790-1lbtz5h.uu62/PSA-iOS-Audit.app' application. Make sure the correct deployment target has been selected for its compilation in Xcode.
at getResponseForW3CError (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/errors.js:804:9)
at asyncHandler (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/protocol/protocol.js:381:37)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
... 45 more

Any one know how to solve this problem?

Note: in real device I also cannot install ipa file using xcode or appium desktop.

答案1

得分: 2

让我们首先澄清一些事情:

对于真实设备,您必须提供**.ipa**文件。

对于模拟器,您必须提供**.app**文件。

使用模拟器更容易,只需查看官方文档。您可以摆脱UDID、XCODE_ORG_ID和XCODE_SIGNING_ID。确保XCode支持您用deviceNameplatformVersion定义的模拟器。

如果您想尝试真实设备,这是一个完全不同的过程,您绝对需要查看官方的手册

确保您拥有一个活跃的Apple开发者账户,并且可以访问签名了测试应用程序的配置文件。按照文档中所述,为WebDriverAgent签名使用相同的配置文件。然后它应该可以正常工作。

英文:

Let's clarify few things first:

For real device you must provide .ipa file.

For simulator you must provide .app file.

It is easier to go with simulator, just check official docs. You can get rid of UDID, XCODE_ORG_ID and XCODE_SIGNING_ID. Make sure XCode supports simulator that you defined with deviceName and platformVersion.

If you want to try real device, it is quite different process and you definitely need to check official manual.

Make sure you have an active Apple developer account and have access to provision profile test application was signed. Use the same profile for WebDriverAgent signing as stated in documentation. Then it should work fine.

答案2

得分: 2

.ipa文件用于真实设备,.app文件用于模拟器。

可以在文件导航器的“Product”下找到.app文件,或者可以从派生数据查找器窗口中进行搜索。

然后在Appium中为模拟器使用以下能力。

{
  "platformName": "iOS",
  "deviceName": "模拟器名称",
  "noReset": true,
  "platformVersion": "平台版本",
  "app": ".app文件路径",
  "automationName": "XCUITest"
}

Real Device Setup中获取更多信息。

英文:

.ipa file used in real device and .app file used in simulator.

.app file can be found under 'Product' in file navigator or you can search it from derive data finder window.

and then use following capabilities for simulator in appium.

{
"platformName": "iOS",
"deviceName": "Simulator name",
"noReset": true,
"platformVersion": "PlateForm Version",
"app": ".app file path",
"automationName": "XCUITest"
}

find more information from Real Device Setup

huangapple
  • 本文由 发表于 2020年10月14日 17:12:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/64350092.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定