Can't launch an installed app on iOS 10 (simulator)

Hi,

I’ve recently updated to Xcode 8 and Appium 1.6 and I can’t manage to create an appium driver without re-installing the app.

I do manage to create an appium driver if I set the ‘app’ capability (i.e providing the path pf the .app file):
when I do that the app is installed on the simulator, then the WebDriver Runner is installed and launched (is this the intended behavior??) and after that the app is launched. I do some login actions and close the app (quit the appium driver).
Later on I try to create an appium driver with the app bundle id (without the full path of the app file). At this stage the app is already installed on the simulator instance. As far as I know it should create an appium driver and launch the app but I get this error instead:

[debug] [XCUITest] Installing app ‘undefined’ on device
[simctl] Error: simctl error running ‘install’: An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.

Does anyone have an idea what’s the problem? I should mention that opening the app by triggering ‘xcrun simctl launch’ works like a charm.
Am I missing some capabilities? If someone can share his capabilities for launching an installed app on iOS 10 simulator I’ll be most grateful…

here is the log:

[HTTP] --> POST /wd/hub/session {“desiredCapabilities”:{“locationServicesAuthorized”:true,“noReset”:true,“newCommandTimeout”:600,“platformVersion”:“10.0”,“bundleId”:“com.myapp.iphone”,“autoDismissAlerts”:true,“platformName”:“iOS”,“locationServicesEnabled”:true,“deviceName”:“iPhone 7”,“launchTimeout”:30000,“autoAcceptAlerts”:true}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"locationServicesAuthoriz…
[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] locationServicesAuthorized: true
[Appium] noReset: true
[Appium] newCommandTimeout: 600
[Appium] platformVersion: ‘10.0’
[Appium] bundleId: ‘com.myapp.iphone’
[Appium] autoDismissAlerts: true
[Appium] platformName: ‘iOS’
[Appium] locationServicesEnabled: true
[Appium] deviceName: ‘iPhone 7’
[Appium] launchTimeout: 30000
[Appium] autoAcceptAlerts: true
[debug] [XCUITest] XCUITestDriver version: 2.0.26
[BaseDriver] Session created with session id: d5e42e42-4e94-45f2-82d6-fde1f2e6b581
[debug] [XCUITest] Xcode version set to ‘8.0’
[debug] [XCUITest] iOS SDK Version set to ‘10.0’
[iOSSim] Constructing iOS simulator for Xcode version 8.0 with udid ‘31F9EAAE-0174-4200-AECF-521F1491AB86’
[XCUITest] Determining device to run tests on: udid: ‘31F9EAAE-0174-4200-AECF-521F1491AB86’, real device: false
[debug] [iOSLog] Starting iOS 10.0 simulator log capture
[debug] [iOSLog] System log path: /Users/idan/Library/Logs/CoreSimulator/31F9EAAE-0174-4200-AECF-521F1491AB86/system.log
[XCUITest] Setting up simulator
[debug] [iOS] No reason to set locale
[debug] [iOS] Setting iOS and app preferences
[debug] [iOS] Setting location services to 1
[debug] [iOS] Authorizing location services for app
[debug] [iOSSim] Updating location client file: /Users/idan/Library/Developer/CoreSimulator/Devices/31F9EAAE-0174-4200-AECF-521F1491AB86/data/Library/Caches/locationd/clients.plist
[debug] [iOS] Updated plist files, rebooting the simulator if it’s already open
[debug] [iOS] Killing the simulator
[debug] [iOSSim] Killing all iOS Simulators
[XCUITest] Simulator with udid ‘31F9EAAE-0174-4200-AECF-521F1491AB86’ not booted. Booting up now
[debug] [iOSSim] Killing all iOS Simulators
[iOSSim] Starting simulator with command: open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app --args -CurrentDeviceUDID 31F9EAAE-0174-4200-AECF-521F1491AB86
[iOSSim] Tailing simulator logs until we encounter the string “SMS Plugin initialized”
[iOSSim] We will time out after 60000ms
[debug] [iOSSim] Waiting an extra 10000ms for the simulator to really finish booting
[debug] [iOSSim] Done waiting extra time for simulator
[iOSSim] Simulator booted in 15582ms
[debug] [XCUITest] Installing app ‘undefined’ on device
[simctl] Error: simctl error running ‘install’: An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at simCommand$ (lib/simctl.js:22:11)
at tryCatch (/Users/idan/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/idan/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Users/idan/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Users/idan/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at process._tickCallback (internal/process/next_tick.js:103:7)
Error: simctl error running ‘install’: An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at simCommand$ (lib/simctl.js:22:11)
at tryCatch (/Users/idan/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/idan/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Users/idan/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Users/idan/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at process._tickCallback (internal/process/next_tick.js:103:7)
[XCUITest] Error: simctl error running ‘install’: An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at simCommand$ (lib/simctl.js:22:11)
at tryCatch (/Users/idan/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/idan/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Users/idan/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Users/idan/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at process._tickCallback (internal/process/next_tick.js:103:7)
Error: simctl error running ‘install’: An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at simCommand$ (lib/simctl.js:22:11)
at tryCatch (/Users/idan/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/idan/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Users/idan/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Users/idan/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at process._tickCallback (internal/process/next_tick.js:103:7)
[debug] [XCUITest] Reset not set, not ending sim
[debug] [iOSLog] Stopping iOS log capture
[MJSONWP] Encountered internal error running command: Error: simctl error running ‘install’: An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at simCommand$ (lib/simctl.js:22:11)
at tryCatch (/Users/idan/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/idan/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Users/idan/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Users/idan/.npm-packages/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at process._tickCallback (internal/process/next_tick.js:103:7)
[HTTP] <-- POST /wd/hub/session 500 27578 ms - 414

    if (devicePlatform.contains("fullReset")) { // reinstall client
        System.out.println("  Driver DO FULL-RESET");
        capabilities.setCapability(MobileCapabilityType.FULL_RESET, true);
        capabilities.setCapability(MobileCapabilityType.NO_RESET, false);
    } else if (devicePlatform.contains("fastReset")) { // clears cache without reinstall
        System.out.println("  Driver DO FAST-RESET");
        capabilities.setCapability(MobileCapabilityType.FULL_RESET, false);
        capabilities.setCapability(MobileCapabilityType.NO_RESET, false);
    } else {
        System.out.println("  Driver DO NORMAL start");
        capabilities.setCapability(MobileCapabilityType.FULL_RESET, false);
        capabilities.setCapability(MobileCapabilityType.NO_RESET, true);
    }

Thanks for the quick response :slight_smile:

I’ve tried all of these capabilities combination, mainly the fullReset=false & noReset=true but I still get the same error.
needles to say I ran these capabilities dozens of times without any issues on previous versions of appium and Xcode 7.

I just don’t understand why the installation attempt occurs - according to the capabilities it shouldn’t do that.

noReset: true
bundleId: 'com.myapp.iphone’
autoDismissAlerts: true
locationServicesEnabled: true
deviceName: 'iPhone 7’
launchTimeout: 30000
fullReset: false
locationServicesAuthorized: true
newCommandTimeout: 600
platformVersion: '10.0’
platformName: 'iOS’
autoAcceptAlerts: true

Can you attach the log of a successful app launch (in case you happen to run one soon)? This logs comparison might be helpful.

If any of you has some other idea I’ll be more than happy to try it…
Thanks in advanced!

Gave up on trying to launch the app by providing only the bundle id (as I used to do in older versions of Appium).
Adding the app capability to all of the driver creation attempts isn’t very elegant but at least it works…

mine attributes for iOS (from mine logs. some attributes do not work in 1.6.1 - i just left as is from 1.5.3 with hope that it will be supported later):

start appium as: [appium, --log-level, error, --port, 4727, --command-timeout, 120, --session-override]
Capabilities [{app=/Users/Aleksei/Downloads/test_clients/xxxx.app, noReset=false, newCommandTimeout=120, platformVersion=10.1, automationName=Appium, browserName=, waitForAppScript=$.delay(3000); $.acceptAlert(); true;, version=, deviceName=iPhone 6s, fullReset=false, platform=MAC}]
open driver for iOS
IOSDriver: http://0.0.0.0:4727/wd/hub