Could not find a device to launch ... due to device string mutilation

Context:

  • Automating iOS/iPhone
  • with Appium version 1.3.4
  • on iOS Simulator
  • using WebdriverIO (JavaScript)
  • on Mac OS X Yosemite

The Appium server capabilities doc says the following with regard to deviceName.

On iOS, this should be one of the valid devices returned by instruments with instruments -s devices. On Android this capability is currently ignored.

When I run the instruments command the string I see for iPhone 5s is:

iPhone 5s (8.1 Simulator) [65285972-3FFE-4E68-822E-66F7CC91C329]

When I use this in the capabilities section of my Gruntfile.coffee, like so:

...
desiredCapabilities:
            'automationName': 'Appium',
            'appiumVersion': '1.3.4',
            'platformName': 'iOS',
            'platformVersion': '8.1',
            'deviceName': 'iPhone 5s (8.1 Simulator) [65285972-3FFE-4E68-822E-66F7CC91C329]',
            #'deviceName': 'iPhone Simulator'
            'browserName': 'Safari',
            'device-orientation': 'portrait',
...

the test run fails with this error message in the Appium console:

...
error: Could not find a device to launch. You requested 'iPhone 5s (8.1 Simulator) [65285972-3FFE-4E68-822E-66F7CC91C329] (8.1 Simulator)', but the available devices were: ["iPad 2 (8.1 Simulator) [4F9DED1C-B970-4FD3-BC8E-AFFF3287B2C2]","iPad Air (8.1 Simulator) [1233E320-36A0-495D-9820-83ACF60BE136]","iPad Retina (8.1 Simulator) [6C5F7EC5-D2FE-4013-8353-24D3BCE3F457]","iPhone 4s (8.1 Simulator) [0911B087-79F0-48D7-8C31-5D9D1E089AA1]","iPhone 5 (8.1 Simulator) [E542C9E2-13BB-457E-B0CE-A90AE111AB1A]","iPhone 5s (8.1 Simulator) [65285972-3FFE-4E68-822E-66F7CC91C329]","iPhone 6 (8.1 Simulator) [EA61982D-0616-4752-ADC9-858E26BF3366]","iPhone 6 Plus (8.1 Simulator) [B5B211BE-0A61-4098-A334-3F2516172159]"]
...

Just above this line in the console, the computed device string is shown as:

...
info: [debug] Final device string is: 'iPhone 5s (8.1 Simulator) [65285972-3FFE-4E68-822E-66F7CC91C329] (8.1 Simulator)'
...

Further up the console, in the echo of the POST command that gets this all started, we see:

...
info: --> POST /wd/hub/session {"desiredCapabilities":{"browserName":"Safari","version":"","javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"platform":"ANY","automationName":"Appium","appiumVersion":"1.3.4","platformName":"iOS","platformVersion":"8.1","deviceName":"iPhone 5s (8.1 Simulator) [65285972-3FFE-4E68-822E-66F7CC91C329]","device-orientation":"portrait","requestOrigins":{"url":"http://webdriver.io","version":"2.4.0","name":"webdriverio"}}}
...

As you can see, the configuration is received correctly by Appium, but there is an extra " (8.1 Simulator)" appended to an otherwise correct device string to create the “final device string”. This “final device string” is computed in the following code fragment (lines 982 to 987) of appium/lib/devices/ios/ios.js :

...
var reqVersion = opts.platformVersion || opts.iOSSDKVersion;
if (opts.iOSSDKVersion >= 8) {
  iosDeviceString += " (" + reqVersion + " Simulator)";
} else if (opts.iOSSDKVersion >= 7.1) {
  iosDeviceString += " - Simulator - iOS " + reqVersion;
}
...

As a simple test, if I comment out line 984,

...
// iosDeviceString += " (" + reqVersion + " Simulator)";
...

the test runs happily, and the Appium console shows the unmutilated, original, correct device string as the “final device string”. This device string is then properly recognized by the iOS Simulator.

So, looks like the iosDeviceString computation in ios.js needs to be reworked.

2 Likes

I am also facing the same issue. I am eagerly waiting for this to be fixed ASAP.

Expanding on your question, is it possible to remove the (Simulator) altogether to run in on a real device or is there a different way of doing that?

@PeterKMT I think your question deserves a separate thread. This thread is about a specific bug.

+1 I am getting the same issue

ok this is solved, just do
‘deviceName’: ‘=iPhone’

or

‘deviceName’: ‘=YOUR_UDID’

Is this issue resolved ? I am still facing the same issue in Appium Version 1.4.0 (Draco). Is there a work around ?

tried with 1.4.8, still the issue. You have to add the “=” sign

1 Like

Can you please eloborate where to add “=” sign as i am also facing same issue with appium 1.4.8
?

Example: 'deviceName': '=iPhone 6'

1 Like