Application crashing

I am trying to automate Office 365 application on iPhone and when I try to do that through Appium, the application crashes. I am able to manually run the app on the device. What is the correct procedure and what is required for automating iOS apps through Appium

This is the log…

info: [debug] [INST] Waiting for device to boot…

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.3.7”,“revision”:“72fbfaa116d3d9f6a862600ee99cf02f6d0e2182”},“isShuttingDown”:false},“sessionId”:“7f9ec584-67b8-4784-83bf-3137355a70d8”}
info: <-- GET /wd/hub/status 200 1.557 ms - 178 {“status”:0,“value”:{“build”:{“version”:“1.3.7”,“revision”:“72fbfaa116d3d9f6a862600ee99cf02f6d0e2182”},“isShuttingDown”:false},“sessionId”:“7f9ec584-67b8-4784-83bf-3137355a70d8”}

warn: Instruments socket client never checked in; timing out (global)

info: [debug] Killall instruments

info: [debug] [INSTSERVER] Instruments exited with code null

info: [debug] Killall instruments
info: [debug] Instruments never checked in
info: [debug] Attempting to retry launching instruments, this is retry #1
info: [debug] Killall iOS Simulator

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.3.7”,“revision”:“72fbfaa116d3d9f6a862600ee99cf02f6d0e2182”},“isShuttingDown”:false},“sessionId”:“7f9ec584-67b8-4784-83bf-3137355a70d8”}
info: <-- GET /wd/hub/status 200 1.067 ms - 178 {“status”:0,“value”:{“build”:{“version”:“1.3.7”,“revision”:“72fbfaa116d3d9f6a862600ee99cf02f6d0e2182”},“isShuttingDown”:false},“sessionId”:“7f9ec584-67b8-4784-83bf-3137355a70d8”}

info: Launching instruments

info: [debug] Attempting to run app on iPhone 5 (8.1 Simulator)

info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w “iPhone 5 (8.1 Simulator)” /var/folders/kg/ndh6lnmd2_g8kzphf4dhr34w0000gq/T/115317-21264-1mkd68p/Payload/O365AdminiOS.app -e UIASCRIPT “/Users/CHANDAN/Library/Application Support/appium/bootstrap/bootstrap-931e8d7703a594e3.js” -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {“DYLD_INSERT_LIBRARIES”:"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd6/InstrumentsShim.dylib",“LIB_PATH”:"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd6"}
info: [debug] And launch timeouts (in ms): {“global”:90000}

info: [debug] [INST] Waiting for device to boot…

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.3.7”,“revision”:“72fbfaa116d3d9f6a862600ee99cf02f6d0e2182”},“isShuttingDown”:false},“sessionId”:“7f9ec584-67b8-4784-83bf-3137355a70d8”}
info: <-- GET /wd/hub/status 200 1.130 ms - 178 {“status”:0,“value”:{“build”:{“version”:“1.3.7”,“revision”:“72fbfaa116d3d9f6a862600ee99cf02f6d0e2182”},“isShuttingDown”:false},“sessionId”:“7f9ec584-67b8-4784-83bf-3137355a70d8”}

warn: Instruments socket client never checked in; timing out (global)

info: [debug] Killall instruments

info: [debug] [INSTSERVER] Instruments exited with code null
info: [debug] Killall instruments

info: [debug] Instruments never checked in

info: [debug] Attempting to retry launching instruments, this is retry #2
info: [debug] Killall iOS Simulator

info: Launching instruments

info: [debug] Attempting to run app on iPhone 5 (8.1 Simulator)

info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w “iPhone 5 (8.1 Simulator)” /var/folders/kg/ndh6lnmd2_g8kzphf4dhr34w0000gq/T/115317-21264-1mkd68p/Payload/O365AdminiOS.app -e UIASCRIPT “/Users/CHANDAN/Library/Application Support/appium/bootstrap/bootstrap-931e8d7703a594e3.js” -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {“DYLD_INSERT_LIBRARIES”:"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd6/InstrumentsShim.dylib",“LIB_PATH”:"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd6"}
info: [debug] And launch timeouts (in ms): {“global”:90000}

info: [debug] [INST] Waiting for device to boot…

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.3.7”,“revision”:“72fbfaa116d3d9f6a862600ee99cf02f6d0e2182”},“isShuttingDown”:false},“sessionId”:“7f9ec584-67b8-4784-83bf-3137355a70d8”}
info: <-- GET /wd/hub/status 200 0.797 ms - 178 {“status”:0,“value”:{“build”:{“version”:“1.3.7”,“revision”:“72fbfaa116d3d9f6a862600ee99cf02f6d0e2182”},“isShuttingDown”:false},“sessionId”:“7f9ec584-67b8-4784-83bf-3137355a70d8”}

info: [debug] [INST STDERR] Instruments Trace Error : Target failed to run: Failed looking up pid of launched process

info: [debug] [INSTSERVER] Instruments exited with code 253

info: [debug] Killall instruments

info: [debug] Instruments crashed on startup

info: [debug] Attempting to retry launching instruments, this is retry #3
info: [debug] Killall iOS Simulator

info: Launching instruments

info: [debug] Attempting to run app on iPhone 5 (8.1 Simulator)

info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w “iPhone 5 (8.1 Simulator)” /var/folders/kg/ndh6lnmd2_g8kzphf4dhr34w0000gq/T/115317-21264-1mkd68p/Payload/O365AdminiOS.app -e UIASCRIPT “/Users/CHANDAN/Library/Application Support/appium/bootstrap/bootstrap-931e8d7703a594e3.js” -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {“DYLD_INSERT_LIBRARIES”:"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd6/InstrumentsShim.dylib",“LIB_PATH”:"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd6"}
info: [debug] And launch timeouts (in ms): {“global”:90000}

info: [debug] [INST] Waiting for device to boot…

info: [debug] [INST STDERR] Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 8.) : Failed to launch process with bundle identifier ‘com.microsoft.o365shdmobileapp’

info: [debug] [INSTSERVER] Instruments exited with code 253

info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] We exceeded the number of retries allowed for instruments to successfully start; failing launch
info: [debug] Stopping iOS log capture
info: [debug] Running ios sim reset flow
info: [debug] Killing the simulator process
info: [debug] Killall iOS Simulator
info: [debug] Killing any other simulator daemons

info
info: [debug] Cleaning sim data files

Executing: xcrun simctl erase 6731FF51-CCB6-4E3B-81E5-6934680BEB5F with timeout 2000

info
Executing: xcrun simctl erase 6731FF51-CCB6-4E3B-81E5-6934680BEB5F with timeout 2000

info: [debug] Cleaning app data files

info
warn: Applications directory /Users/CHANDAN/Library/Developer/CoreSimulator/Devices/6731FF51-CCB6-4E3B-81E5-6934680BEB5F/data/Containers/Data/Application doesn’t exist. Have you run this simulator before?
warn: Applications directory /Users/CHANDAN/Library/Developer/CoreSimulator/Devices/6731FF51-CCB6-4E3B-81E5-6934680BEB5F/data/Containers/Bundle/Application doesn’t exist. Have you run this simulator before?
info: Couldn’t find app directories to delete. Probably it’s not installed
info: [debug] Resetting Content and Settings for Simulator

Executing: xcrun simctl erase 6731FF51-CCB6-4E3B-81E5-6934680BEB5F with timeout 2000

info: [debug] Cleaning up appium session
info: [debug] Error: Instruments crashed on startup
at Instruments.onInstrumentsExit (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:389:31)
at null. (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:308:12)
at ChildProcess.emit (events.js:110:17)
at Process.ChildProcess._handle.onexit (child_process.js:1067:12)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Instruments crashed on startup)”,“origValue”:“Instruments crashed on startup”},“sessionId”:null}
info: <-- POST /wd/hub/session 500 300087.975 ms - 182

error: Failed to start an Appium session, err was: Error: Instruments crashed on startup

info: --> GET /wd/hub/status {}

info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.3.7”,“revision”:“72fbfaa116d3d9f6a862600ee99cf02f6d0e2182”}}}
info: <-- GET /wd/hub/status 200 1.449 ms - 104 {“status”:0,“value”:{“build”:{“version”:“1.3.7”,“revision”:“72fbfaa116d3d9f6a862600ee99cf02f6d0e2182”}}}

Probably check the app path which you are trying to install in iPhone Simulator.
Also check the desired capability which you are setting. For testing native application on iPhoneSimulator we need - “app” and “deviceName” capability. Also the browserName capabiity should be an empty string

The office 365 app is not a native app. It is a hybrid app and downloaded from app store. Had already tried the settings you mentioned. I am trying this on a real device not on a simulator. I am able to automate a native app like Settings.

Probably you can solve this problem by giving the app activity with desired capabilities, i tried it on Android but don’t know much about iOS.
In android it can be done just by giving the app activity in desired capability :-

  • capabilities.setCapability(“appPackage”, “com.google.android.dialer”);
  •   capabilities.setCapability("appActivity", "com.google.android.dialer.extensions.GoogleDialtactsActivity");
    

I used it for automating phone app on android 5.1.1.
And if i m wrong in case of iOS then wants to hear from you!!