Appium error on IOS while running tests -> Error: simctl error running 'create': Invalid device type:

Unable to execute tests on MAC OS Sierra. Below is the environment information and the code snippets. In addition, you can find the error logs from appium. Any pointers on what information needs to be provided for devicename and why i am getting this error will help.

The device connected to the machine is recognized in xcode with the same name, as being provided in the code snippet, that should launch the app.

Appium version : 1.6.3 MAC OS Version : 10.12.2 XCode Version : 8.2

Application Launch Code:
public class TC_MobileLogin {
public static AppiumDriver wd;
@Test
public void StartLogin() throws IOException {
DesiredCapabilities capability = new DesiredCapabilities();
capability.setCapability(MobileCapabilityType.PLATFORM_NAME,“iOS”);
capability.setCapability(MobileCapabilityType.PLATFORM_VERSION,“10.2”);
capability.setCapability(MobileCapabilityType.DEVICE_NAME,“iphone”);
File app = new File("/Users/samanth/Downloads/myapp.ipa");
capability.setCapability(“app”, app.getAbsolutePath());
wd = new IOSDriver(new URL(“http://0.0.0.0:4723/wd/hub”), capability);
wd.manage().timeouts().implicitlyWait(80, TimeUnit.SECONDS);
}
}

========================
Error I receive in Appium :

[HTTP] --> POST /wd/hub/session {“desiredCapabilities”:{“app”:"/Users/samanth/Downloads/myapp.ipa",“platformName”:“iOS”,“deviceName”:“iphone”,“platformVersion”:“10.2”}}

[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{“app”:"/Users/samanth/Downloads/myapp.ipa",“platformName”:“iOS”,“deviceName”:“iphone”,“platformVersion”:“10.2”},null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]

[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/samanth/Downloads/myapp.ipa’
[Appium] platformName: ‘iOS’
[Appium] deviceName: ‘iphone’
[Appium] platformVersion: ‘10.2’
[debug] [XCUITest] XCUITestDriver version: 2.4.2
[BaseDriver] Session created with session id: 42938854-74eb-4c48-97e8-606f88b705b4
[debug] [XCUITest] Xcode version set to ‘8.2.1’
[debug] [XCUITest] iOS SDK Version set to ‘10.2’

[XCUITest] Simluator udid not provided, using desired caps to create a new simulator

[simctl] Error: simctl error running ‘create’: Invalid device type: iphone
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at simCommand$ (lib/simctl.js:22:11)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)

Maybe try adding.

capabilities.setCapability(“udid”,strIOSUdid);
//Real Devices
capabilities.setCapability(“deviceName”,strIOSDeviceName+"("+strIOSUdid+")");

I haven’t test a real device on 1.6.3, but when I did test one I need the above.

DD

1 Like

You were right… Set the Desired Capability of udid… worked like a charm… !!

Thanks a ton !! solved a couple of days frustration.