Appium [iOS] Instruments crashed on startup - ios

When Appium tries to run application, the screen flashes with app splash screen, as if Appium tries to launch app multiple times. This behaviour happens both on simulator and real device.
I set enable on my iOS devices UI Automation, but when I try start inspector I have this problem:
info: [debug] [INST STDERR] 2015-11-05 15:11:05.082 instruments[1495:39489] WebKit Threading Violation - initial use of WebKit from a secondary thread.
info: [debug] [INST STDERR] 2015-11-05 15:11:06.049 instruments[1495:39460] Attempting to change event horizon while disengage
error: Failed to start an Appium session, err was: Error: Instruments crashed on startup
info: [debug] [INST STDERR] 2015-11-05 15:11:06.049 instruments[1495:39462] Attempting to change event horizon while disengage
Instruments Trace Error : Target failed to run: Permission to debug com.myapp.iphone was denied. The app must be signed with a development identity (e.g. iOS Developer).
info: [IOS_SYSLOG_ROW ] Nov 5 15:11:04 tests-iPod com.apple.xpc.launchd[1] (UIKitApplication:com.myapp.iphone[0xe163][607]) <Notice>: Service exited due to signal: Killed: 9
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] Reset not set, not ending sim or cleaning up app state
info: [debug] Cleaning up appium session
info: [debug] Error: Instruments crashed on startup
at [object Object].Instruments.onInstrumentsExit (/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/lib/instruments.js:440:31)
at [object Object].<anonymous> (/Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-instruments/lib/instruments.js:353:12)
at ChildProcess.emit (events.js:110:17)
at Process.ChildProcess._handle.onexit (child_process.js:1074: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 33841.937 ms - 182}
Application is in form of .ipa

Target failed to run: Permission to debug com.myapp.iphone was denied.
The app must be signed with a development identity (e.g. iOS Developer).
You application should be signed with developers key. Click here for documentation

If you are using iOS Simulator, do the following...
In Appium, go to Developer Settings, Check Custome Server Flags and write --native-instruments-lib in the text box.
Now start Appium Server.
Hope this helps!

BlockquoteTarget failed to run: Permission to debug com.myapp.iphone was denied.
The app must be signed with a development identity (e.g. iOS Developer).
Blockquote
You should give your developer identity while creating the .ipa...
If you are creating ipa file through terminal, you can follow the given link [blog]: Xcode "Build and Archive" from command line

I also struggled with this problem and found that you need to enable UI automation in developer option in you iDevice
How to enable UI Automation
1. switch off the iDevice,
2. then connect it to the Mac running Xcode
3. before switching it back on to have Developer options appear.
4. tap on developer option and Enable UI automation

In my case, the following command made my life hell:
rm -rf $HOME/Library/Developer/Xcode/iOS\ DeviceSupport/*
So don't add it to the build step.
To fix the issue:
Restart device > run Xcode > connect device > build & run the app > stop & quit Xcode
Now verify launching app without crashing the instruments.

Related

Appium: Attempting to change event horizon while disengage

As I'm new to Appium on IOS, I couldn't find the issue
I'm facing this issue.
---> I have given the app path as .app file on simulator----Still fails
---> I have used .ipa file on real device--- Still fails.
Every time the app opens and crashes in a loop on startup.
[INST STDERR] 2016-03-29 15:58:51.215 instruments[2825:122645] Attempting to change event horizon while disengage
2016-03-29 15:58:51.216 instruments[2825:125164] Attempting to change event horizon while disengage
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
Mac OS-10.11.4
Xcode 7.2.1
App OS-8.4
Simulator: iphone 5s
Real device: Iphone 5c
Could anyone help me with this please ?
Thanks in advance.

How to Run Appium on ios Simulator 8.x/7.x

I am trying to do the automation using Appium on ios simulators.
My config is:
OS version: 10.10.x
Appium: 1.4.0
Xcode: 6.3.2
and caps for appium is:
automationName = "Appium"
platformName = "iOS"
platformVersion = "8.3"
deviceName = "iPhone 5s"
app = "/Users/skaram200/Desktop/ios_build/XfinityMyAccount_6.3.app"
When I run the appium it is giving me an error:
info: [debug] Attempting to run app on iPhone 5s (8.3 Simulator)
info: [debug] Spawning instruments with command: /Applications/xcode6.3/Xcode6.3.2.app/Contents/Developer/usr/bin/instruments -t /Applications/xcode6.3/Xcode6.3.2.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w "iPhone 5s (8.3 Simulator)" /Users/skaram200/Desktop/ios_build/XfinityMyAccount_6.3.app -e UIASCRIPT "/Users/skaram200/Library/Application Support/appium/bootstrap/bootstrap-4d92d75355d74eeb.js" -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/Users/skaram200/Documents/workspace/appium_1/node_modules/appium-instruments/thirdparty/iwd6/InstrumentsShim.dylib","LIB_PATH":"/Users/skaram200/Documents/workspace/appium_1/node_modules/appium-instruments/thirdparty/iwd6"}
info: [debug] And launch timeouts (in ms): {"global":90000}
info: [debug] [INST STDERR] 2015-09-10 10:47:20.672 instruments[36855:1272282] WebKit Threading Violation - initial use of WebKit from a secondary thread.
info: [debug] [INST] Waiting for device to boot...
info: [debug] [INST STDERR] Instruments Trace Error : Target failed to run: Unable to install app with path: /Users/skaram200/Desktop/ios_build/XfinityMyAccount_6.3.app: "(null)"
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] Killing any other simulator daemons
info: [debug] Killall iOS Simulator
info: [debug] Cleaning sim data files
info: Executing: xcrun simctl erase F54870E7-17FD-4A07-B6EE-1636F6AB5757 with timeout 2000
info: Executing: xcrun simctl erase F54870E7-17FD-4A07-B6EE-1636F6AB5757 with timeout 2000
info: [debug] Cleaning app data files
warn: Applications directory /Users/skaram200/Library/Developer/CoreSimulator/Devices/F54870E7-17FD-4A07-B6EE-1636F6AB5757/data/Applications doesn't exist. Have you run this simulator before?
info: Couldn't find app directories to delete. Probably it's not installed
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Instruments crashed on startup
info: [debug] Error: Instruments crashed on startup
at [object Object].Instruments.onInstrumentsExit (/Users/skaram200/Documents/workspace/appium_1/node_modules/appium-instruments/lib/instruments.js:440:31)
at [object Object].<anonymous> (/Users/skaram200/Documents/workspace/appium_1/node_modules/appium-instruments/lib/instruments.js:353:12)
at ChildProcess.emit (events.js:110:17)
at Process.ChildProcess._handle.onexit (child_process.js:1074: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}
```
Please let me know, how can I resolve these errors and start automating on ios simulators using appium.
Here you need to pass the --default-device or -dd as true for simulators and need to specify the --bundleID of the app. And we need to have debug .ipa or .app file to do automation.
Creating a successfull Build without an error.
I'm using Cordova, got some issues with that as well, this is what Idid in order to generate the .app:
cordova build ios --emulator
That's it, after that I was able to use Appium and push the .app to the simulator.
I hope it helps somebody else!

Appium [iOS] - Couldn't launch app on simulator

I had installed Appium and all necessary stuff for running of application via iOS Simulator
Then I started a simulator and launched the Appium (sure path to application was set in Settings before launching)
I don't know whether the application should be open immediately after launching or not. That's why I ran Inspector. Seems the device was connected and installation of app was started. App crashed after the launch screen was shown. I tried the same flow with another application, getting the same result. Here are logs from Appium:
info: [IOS_SYSLOG_ROW ] Jul 24 10:29:07 MacBook-apple com.apple.CoreSimulator.SimDevice.73F7270E-C69E-4CF5-8586-39358163963A.launchd_sim[6364] (UIKitApplication:com.wholefoods.WholeFoods[0x7ca4][6420]): Program specified by service does not contain one of the requested architectures: �<0
info: [IOS_SYSLOG_ROW ] Jul 24 10:29:07 MacBook-apple.local SpringBoard[6378]: Unable to get pid for 'UIKitApplication:com.wholefoods.WholeFoods[0x7ca4]': No such process (err 3)
info: [IOS_SYSLOG_ROW ] Jul 24 10:29:07 MacBook-apple.local SpringBoard[6378]: Unable to delete job with label UIKitApplication:com.wholefoods.WholeFoods[0x7ca4]. Error: Operation now in progress
info: [IOS_SYSLOG_ROW ] Jul 24 10:29:07 MacBook-apple.local SpringBoard[6378]: Application 'UIKitApplication:com.wholefoods.WholeFoods[0x7ca4]' exited for an unknown reason.
info: [IOS_SYSLOG_ROW ] Jul 24 10:29:07 MacBook-apple com.apple.CoreSimulator.SimDevice.73F7270E-C69E-4CF5-8586-39358163963A.launchd_sim[6364] (UIKitApplication:com.wholefoods.WholeFoods[0x7ca4][6420]): Trampoline was terminated before jumping to service: Killed: 9
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 #2
info: [debug] Killall iOS Simulator
info: [IOS_SYSLOG_ROW ] Jul 24 10:29:07 MacBook-apple.local DTMobileIS[6387]: Could not create service named com.apple.instruments.server.services.processcontrol.posixspawn
info: [IOS_SYSLOG_ROW ] Jul 24 10:29:07 MacBook-apple.local DTMobileIS[6387]: Could not create service named com.apple.instruments.server.services.launchdaemon
info: Launching instruments
info: [debug] Attempting to run app on iPad 2 (8.3 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 "iPad 2 (8.3 Simulator)" /var/folders/7x/pfjm_c_s37ngl66yrs82ry3m0000gn/T/115624-6265-9ypyif/Payload/WholeFoods.app -e UIASCRIPT "/Users/apple/Library/Application Support/appium/bootstrap/bootstrap-4e580d338a12229a.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}
blablabla
info: [debug] Cleaning up appium session
info: [debug] Error: Instruments crashed on startup
at [object Object].Instruments.onInstrumentsExit (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:440:31)
at [object Object].<anonymous> (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:353:12)
at ChildProcess.emit (events.js:110:17)
at Process.ChildProcess._handle.onexit (child_process.js:1074: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 117025.667 ms - 182
error: Failed to start an Appium session, err was: Error: Instruments crashed on startup
The solution is simple, though not trivial
Once you've build the app for the simulator:
In Xcode at the left panel find Products
There you'll find your application. Tap it with right click (even if it is red)
At the right panel you'll see the path at Full Path. Copy it up to last element. For example seeing /projects/.../yourproject-<bhah>/Build/Products/Debug-iphoneos/yourproject.app you need: /projects/.../yourproject-<bhah>/Build/Products
3.1. Or you can find it with:Tap it with right click (even if it is red) and select show in finder
Go one to the enclosing folder (Go->Enclosing folder)
Open that dir. You'll find there Debug-iphonesimulator and yourproject.app there.
that's the one you need

Instruments crashed at start up

I am running appium server 1.2 at MAC OS 10.8.X and appis installed on real iOs device Iphone 5.
When I try to run the test script, it gives me the following error.
info: [debug] App is installed.
info: [debug] fullReset not requested. No need to install.
info: [debug] Starting command proxy.
info: [debug] Instruments socket server started at /tmp/instruments_sock
info: [debug] Starting instruments
info: [debug] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments
info: Launching instruments
info: [debug] Attempting to run app on real device with UDID 1d30758b4d21c267fb261c47d52b1e393357367e
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.bundle/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w 1d30758b4d21c267fb261c47d52b1e393357367e com.equinix.ecpnewappdistribution -e UIASCRIPT "/Users/anujtomar/Library/Application Support/appium/bootstrap/bootstrap-0943baae6b1d6f5b.js" -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {}
info: [debug] And launch timeouts (in ms): {"global":90000}
info: [debug] [INST STDERR] 2014-12-10 15:18:14.827 instruments[6611:707] Failed to start Instruments daemon for 'iOS' on 'Equinix's iPhone (v8.0.2)' (The service is invalid.)
info: [debug] [INST STDERR] 2014-12-10 15:18:14.954 instruments[6611:2203] Failed to start Instruments daemon for 'iOS' on 'Equinix's iPhone (v8.0.2)' (The service is invalid.)
info: [debug] [INSTSERVER] Instruments exited with code 253
info: [debug] Killall instruments
How can I fix this?
The problem seems to be with device. Try below steps:
Open Xcode
Goto Window
Organizer
Under you device name goto Console.
Clear the the console.
And then run test cases again.
Hope that helps !!!
I also faced a similar problem and none of the above techniques worked.
However I was able to run appium by doing the following changes in the setting
choose xcode instruments
choose automation
Look for options and select allow device for automation
A window comes up asking for permission. Select 'okay' and you should be able to run appium now

Appium-Help required: Simulator is not launching application from Appium.app

Having problems in running Appium app for automation mobile app testing
Following tool versions I'm using
Appium version: 1.2.1
Xcode: 5.1.1
Following are the steps which I’m doing,
Download Appium.dmg
Run dmg file and then launched appium.app file
Build application for 7.1 simulator from Xcode
On appium.app, enabled ‘App Path’ option and provided .app file path “/Users/umairrashid/Library/Application Support/iPhone Simulator/7.1/Applications/878133B5-7078-4E92-B3A2-607A3A3C2AC3/Recipes.app”
In ‘General Settings’,
Server Address: 127.0.0.1, Port: 4723
Check for Updates: Enabled
New Command Timeout: 7200s
When I click ‘Launch’ button then everything seems to be okay.
When I click ‘Inspector’ button then following errors displayed,
Could Not Launch Appium Inspector
Could not start a new session
Be sure the Appium server is running with an application opened by using the "App Path" parameter in Appium.app (along with package and activity for Android) or by connecting with selenium client and supplying this in the desired capabilities object.
In Appium Console, I got following error,
2014-08-21T17:57:57.789Z - info: --> POST /wd/hub/session {"desiredCapabilities":{"platformName":"iOS","platformVersion":"7.1","newCommandTimeout":"999999","automationName":"Appium"}}
2014-08-21T17:57:57.792Z - info: <-- POST /wd/hub/session 500 3.235 ms - 286
2014-08-21T17:57:57.772Z - debug: Request received with params: {}
2014-08-21T17:57:57.772Z - debug: Responding to client with success: {"status":0,"value":{"build":{"version":"1.2.0","revision":"e53f49c706a25242e66d36685c268b599cc18da5"}}}
2014-08-21T17:57:57.775Z - debug: Appium request initiated at /wd/hub/sessions
2014-08-21T17:57:57.775Z - debug: Request received with params: {}
2014-08-21T17:57:57.775Z - debug: Responding to client with success: {"status":0,"value":[]}
2014-08-21T17:57:57.789Z - debug: Appium request initiated at /wd/hub/session
2014-08-21T17:57:57.789Z - debug: Request received with params: {"desiredCapabilities":{"platformName":"iOS","platformVersion":"7.1","newCommandTimeout":"999999","automationName":"Appium"}}
2014-08-21T17:57:57.790Z - error: The following desired capabilities are required, but were not provided: deviceName
2014-08-21T17:57:57.790Z - debug: Got configuration error, not starting session
2014-08-21T17:57:57.791Z - debug: Cleaning up appium session
2014-08-21T17:57:57.791Z - error: Failed to start an Appium session, err was: Error: The following desired capabilities are required, but were not provided: deviceName
2014-08-21T17:57:57.791Z - debug: Error: The following desired capabilities are required, but were not provided: deviceName
at Capabilities.checkValidity (/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/lib/server/capabilities.js:120:13)
at Appium.configure (/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/lib/appium.js:256:35)
at Appium.start (/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/lib/appium.js:100:10)
at Object.exports.createSession [as handle] (/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/lib/server/controller.js:159:16)
at next_layer (/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/route.js:103:13)
at Route.dispatch (/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/route.js:107:5)
at /Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:213:24
at Function.proto.process_params (/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:286:12)
at next (/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:207:19)
at next (/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/node_modules/express/lib/router/index.js:182:38)
2014-08-21T17:57:57.791Z - debug: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: The following desired capabilities are required, but were not provided: deviceName)","origValue":"The following desired capabilities are required, but were not provided: deviceName"},"sessionId":null}
2014-08-21T17:58:08.130Z - info: --> GET /wd/hub/status {}
—————————————————
When Launching with ‘Prelaunch Application’:Enabled, got following errors
2014-08-21T18:00:55.417Z - debug: Attempting to retry launching instruments, this is retry #3
2014-08-21T18:00:55.418Z - debug: Killall iPhoneSimulator
2014-08-21T18:01:00.420Z - info: Launching instruments
2014-08-21T18:01:00.421Z - debug: Attempting to run app on iPhone Retina (4-inch) - Simulator - iOS 7.1
2014-08-21T18:01:00.422Z - debug: Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -w iPhone Retina (4-inch) - Simulator - iOS 7.1 /Users/umairrashid/Library/Application Support/iPhone Simulator/7.1/Applications/878133B5-7078-4E92-B3A2-607A3A3C2AC3/Recipes.app -e UIASCRIPT /Users/umairrashid/Library/Application Support/appium/bootstrap/bootstrap-7a459bb511e03f3b.js -e UIARESULTSPATH /tmp/appium-instruments
2014-08-21T18:01:00.422Z - debug: And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd/InstrumentsShim.dylib","LIB_PATH":"/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd"}
2014-08-21T18:01:00.422Z - debug: And launch timeouts (in ms): {"global":90000}
2014-08-21T18:01:01.415Z - debug: [INST STDERR] Instruments Usage Error : Could not remove existing output document 'file:///Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/instrumentscli0.trace': Error Domain=NSCocoaErrorDomain Code=642 "You can’t save the file “instrumentscli0.trace” because the volume “Appium” is read only." UserInfo=0x7fac5e2d6100 {NSFilePath=/Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/instrumentscli0.trace, NSUnderlyingError=0x7fac5d92d760 "The operation couldn’t be completed. Read-only file system"}.
2014-08-21T18:01:01.483Z - debug: [INSTSERVER] Instruments exited with code 254
2014-08-21T18:01:01.483Z - debug: Killall instruments
2014-08-21T18:01:01.486Z - debug: Instruments crashed on startup
Here I'm expecting that when I click Inspect button from Appium then Simulator is launched and I can see XPaths etc in that view.
Are you sure you have the icon of apple selected(Sometimes we do silly misclicks)
If you have have "force device" checked please uncheck it.
If you still have problems it would be better for you to take screenshots of your appium gui and post it here so I can help in a more through way
Are you sure that you have installed Appium by dragging Appium.app to your apps folder?
The below error message suggests that you are just launching it from the DMG file.
Instruments Usage Error : Could not remove existing output document 'file:///Volumes/Appium/Appium.app/Contents/Resources/node_modules/appium/instrumentscli0.trace'

Resources