Appium Automation与iOS模拟器无法正常工作

时间:2015-11-04 09:43:20

标签: ios xcode automation appium

首先,我使用iOS模拟器尝试了以下代码

   DesiredCapabilities capabilities = new DesiredCapabilities();
   capabilities.setCapability("platformName", "iOS");
   capabilities.setCapability("deviceName", "iPhone 6 Plus");
   capabilities.setCapability("platformVersion", "9.1");
   capabilities.setCapability("app", "/Users/Aress-QA/Desktop/PSt-forQA.ipa");
   wd = new IOSDriver(new URL("http://0.0.0.0:4723/wd/hub"),capabilities);
   wd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);

显示以下错误

A new session could not be created. (Original error: Could not find a device to launch. You requested 'iPhone (9.1 Simulator)', but the available devices    were: ["iPad 2 (9.1) [4A9559E1-4671-41F4-A2D0-07A4B1720CB9]","iPad Air (9.1) [02745445-2332-4588-B565-010D958368AF]","iPad Air 2 (9.1) [FF4C3B92-8441-487D-A99B-E2D47A00CEFA]","iPad Pro (9.1) [D741F907-FA3C-45E0-B3B2-5552BF23B4DB]","iPad Retina (9.1) [58471281-5A59-4DFF-B940-A1DF64C2ECF2]","iPhone 4s (9.1) [0ECC93BA-1D51-4FE2-A292-C4E7ACE7C32A]","iPhone 5 (9.1) [B332319F-895B-4F73-A3BD-303958B1126B]","iPhone 5s (9.1) [2235EFFD-E873-4809-AD49-90A26F0F579C]","iPhone 6 (9.1) [34517D5C-0737-4268-867B-ADF66F8CAC96]","iPhone 6 Plus (9.1) [89E70EB8-1D82-4F8A-95DF-EA578C3BAB08]","iPhone 6s (9.1) [598E66DB-1FD2-4439-9337-1406EF8B92E7]","iPhone 6s (9.1) + Apple Watch - 38mm (2.0) [D60DDE8F-EBB9-4226-A891-FE6CD559EE49]","iPhone 6s Plus (9.1) [9BC360EE-09D2-49CF-BD3F-718955330207]","iPhone 6s Plus (9.1) + Apple Watch - 42mm (2.0) [5E51457D-3ABE-4406-ACB3-8AEC579854C1]"]) (WARNING: The server did not provide any stacktrace information)

请帮帮我

2 个答案:

答案 0 :(得分:0)

iPhone (9.1 Simulator) = / = iPhone 5 (9.1)

尝试匹配设备名称。我建议添加UDID参数。 例如。 capabilities.setCapability(MobileCapabilityType.UDID, "2235EFFD-E873-4809-AD49-90A26F0F579C")

答案 1 :(得分:0)

iOS模拟器需要 .app 而不是 .ipa - 如果您在获取.app时遇到问题,请解压缩.ipa文件并在未压缩的文件夹中,你会找到一个.app