Getting 'Posix spawn failure' error - Appium iOS - ios

I am trying to run my automation scripts for one app using Java in Appium iOS.
When I am running on Simulator , getting the following error -
info: Attempting to retry launching instruments, this is retry #1
info: Attempting to run app on iPhone Retina (4-inch) - Simulator - iOS 7.1
info: 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/abc/Desktop/smriti/iPhoneSimulator/AppIOS.app -e UIASCRIPT /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/uiauto/bootstrap.js -e UIARESULTSPATH /tmp/appium-instruments
info: And extra without-delay env: {"DYLD_INSERT_LIBRARIES":"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd/InstrumentsShim.dylib","LIB_PATH":"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd"}
info: And launch timeout: 90000ms
info: [INST STDERR] posix spawn failure; aborting launch (binary == /Users/abc/Desktop/smriti/iPhoneSimulator/AppIOS.app/AppIOS).
info: [INST STDERR] Instruments Trace Error : Error Starting Recording
Then tried running on real device , then getting following error :
info: Installing ipa found at AppIOS.ipa
info: Creating iDevice object with udid 3daa1240e495c84e8878996649301fd9759a07df
info: Couldn't find ideviceinstaller, trying built-in at /Applications/Appium.app/Contents/Resources/node_modules/appium/build/libimobiledevice-macosx/ideviceinstaller
info: Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Command failed: dyld: Library not loaded: #executable_path/../lib/libimobiledevice.3.dylib
Referenced from: /Applications/Appium.app/Contents/Resources/node_modules/appium/build/libimobiledevice-macosx/ideviceinstaller
Reason: image not found
info: Error: Command failed: dyld: Library not loaded: #executable_path/../lib/libimobiledevice.3.dylib
Referenced from: /Applications/Appium.app/Contents/Resources/node_modules/appium/build/libimobiledevice-macosx/ideviceinstaller
Reason: image not found
at ChildProcess.exithandler (child_process.js:637:15)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Socket.<anonymous> (child_process.js:956:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:465:12)
info: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Command failed: dyld: Library not loaded: #executable_path/../lib/libimobiledevice.3.dylib\n Referenced from: /Applications/Appium.app/Contents/Resources/node_modules/appium/build/libimobiledevice-macosx/ideviceinstaller\n Reason: image not found\n)","killed":false,"code":null,"signal":"SIGTRAP","origValue":"Command failed: dyld: Library not loaded: #executable_path/../lib/libimobiledevice.3.dylib\n Referenced from: /Applications/Appium.app/Contents/Resources/node_modules/appium/build/libimobiledevice-macosx/ideviceinstaller\n Reason: image not found\n"},"sessionId":null}
POST /wd/hub/session 500 4286ms - 714b
Then I clicked on 'i' to launch Appium inspector when running on real device -> it launched my app and then app crashed.
Any help would be appreciated.
Thanks!

Take a look at the advice in either of these two threads?
https://groups.google.com/forum/#!topic/appium-discuss/frhUdnCHMms
Or this:
https://groups.google.com/forum/#!msg/appium-discuss/HepKHApmm6w/mu6uGLyNLk0J

You shouldn't attempt installing IPA files on the simulator.
AFAIK, they were built for ARM processors and can run on the iOS devices only.

Related

Unable to launch on iPhone 12 Pro

I was debugging the app normally but today I wanted to test it then this happened.
Terminal Error:
Exception: Unable to launch com.example.tubitakbiyo on 7700*******-9633-1DBF73524FA6:
ProcessException: Process exited abnormally:
com.example.tubitakbiyo: -1
An error was encountered processing the command (domain=FBSOpenApplicationServiceErrorDomain, code=3):
The request to open "com.example.tubitakbiyo" failed.
The process did launch, but has since exited or crashed.
Command: /usr/bin/arch -arm64e xcrun simctl launch 77F612A*********-633-1DBF73524FA6 com.example.tubitakbiyo --enable-dart-profiling --enable-checked-mode --verify-entry-points --start-paused --observatory-port=0
Error launching application on iPhone 12 Pro.
Exited (sigterm)
Problem Report from MAC:
Reason: tried: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/MTBBarcodeScanner.framework/MTBBarcodeScanner' (no such file), '/usr/lib/swift/MTBBarcodeScanner.framework/MTBBarcodeScanner' (no such file), '/Users/cidqu/Library/Developer/CoreSimulator/Devices/77F612AC-5F9C-4E78-9633-1DBF73524FA6/data/Containers/Bundle/Application/F3A022D9-62FF-40B5-994C-B07D54C684E7/Runner.app/Frameworks/MTBBarcodeScanner.framework/MTBBarcodeScanner' (no such file), '/Users/cidqu/Library/Developer/CoreSimulator/Devices/77F612AC-5F9C-4E78-9633-1DBF73524FA6/data/Containers/Bundle/Application/F3A022D9-62FF-40B5-994C-B07D54C684E7
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
I don't have any other errors. How can i solve this?
I fixed the problem by unchecking this option, Run Script: [ ] For install builds only

iPhone automation using selenium webdriver,java,appium and webkit proxy: Not able to execute more than 1 testcase

I am working on iPhone automation using selenium webdriver, appium & ios webkit debug proxy.
Configurations:
OS X Version 10.11.2
Appium 1.3.5
Xcode: 7.2
Device: iPhone 6[9.2]
I have installed safariLauncher app in iPhone using Xcode.
Steps:
I launched appium through terminal.
Cmd: Appium &
Then launched ios-webkit-debug-proxy.
Cmd: ./bin/ios-webkit-debug-proxy-launcher.js -c [device udid]:27753 -d
I launch appium & webkit server every time before starting any test case execution.
Only the first test case works fine and 2nd test case onward run into below error in appium log:
code error: Failed to start an Appium session, err was: Error: Instruments crashed on startup
info: [debug] Error: Instruments crashed on startup
at Instruments.onInstrumentsExit (/usr/local/lib/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:389:31)
at null.<anonymous> (/usr/local/lib/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:308:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:200: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 153251.340 ms - 182
Please suggest any solution.

Appium [iOS] Instruments crashed on startup

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.

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-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