Can't launch iOS app on real device using the Appium 1.6.4 beta

When attempting to run our code on iPhone, the app is installed but Fails to launch.

This is the error in the log:
Unable to launch WebDriverAgent because of xcodebuild failure: Command ‘/bin/bash Scripts/bootstrap.sh -d’ exited with code 1

This is the capabilities we use:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,genMeth.getValueFromPropFile(“deviceName”));
capabilities.setCapability(MobileCapabilityType.UDID, genMeth.getValueFromPropFile(“udid”));
capabilities.setCapability(“app”,genMeth.getValueFromPropFile(“appPath”));
capabilities.setCapability(“automationName”, “XCUITest”);
capabilities.setCapability(“xcodeOrgId”, “7Y5J2RJXYV”);
capabilities.setCapability(“xcodeSigningId”, “iPhone Developer”);
capabilities.setCapability(“useNewWDA”, “true”);
capabilities.setCapability(“wdaLaunchTimeout”, 10000);
capabilities.setCapability(“updatedWDABundleId”, genMeth.getValueFromPropFile(“appIdentifier”));
capabilities.setCapability(“wdaConnectionTimeout”, 10000);

	try {
		
		driver = new IOSDriver<MobileElement>(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);

ENV:
MacOS Sierra 10.12.2
iPhone → . 10.2.1
Appium–> 1.6.4 Beta

This is the full Log:

Last login: Wed Feb 1 23:10:42 on ttys000
Menys-MacBook-Pro:~ menypeled$ appium -g
usage: appium [-h] [-v] [–shell] [–reboot] [–ipa IPA] [-a ADDRESS]
[-p PORT] [-ca CALLBACKADDRESS] [-cp CALLBACKPORT]
[-bp BOOTSTRAPPORT] [-r BACKENDRETRIES] [–session-override]
[-l] [-g LOG]
[–log-level {info,info:debug,info:info,info:warn,info:error,warn,warn:debug,warn:info,warn:warn,warn:error,error,error:debug,error:info,error:warn,error:error,debug,debug:debug,debug:info,debug:warn,debug:error}]
[–log-timestamp] [–local-timezone] [–log-no-colors]
[-G WEBHOOK] [–safari] [–default-device] [–force-iphone]
[–force-ipad] [–tracetemplate AUTOMATIONTRACETEMPLATEPATH]
[–instruments INSTRUMENTSPATH] [–nodeconfig NODECONFIG]
[-ra ROBOTADDRESS] [-rp ROBOTPORT]
[–selendroid-port SELENDROIDPORT]
[–chromedriver-port CHROMEDRIVERPORT]
[–chromedriver-executable CHROMEDRIVEREXECUTABLE]
[–show-config] [–no-perms-check] [–strict-caps]
[–isolate-sim-device] [–tmp TMPDIR] [–trace-dir TRACEDIR]
[–debug-log-spacing] [–suppress-adb-kill-server]
[–async-trace] [–webkit-debug-proxy-port WEBKITDEBUGPROXYPORT]
[–webdriveragent-port WDALOCALPORT] [-dc DEFAULTCAPABILITIES]
[–command-timeout DEFAULTCOMMANDTIMEOUT] [-k]
[–platform-name PLATFORMNAME]
[–platform-version PLATFORMVERSION]
[–automation-name AUTOMATIONNAME] [–device-name DEVICENAME]
[–browser-name BROWSERNAME] [–app APP] [-lt LAUNCHTIMEOUT]
[–language LANGUAGE] [–locale LOCALE] [-U UDID]
[–orientation ORIENTATION] [–no-reset] [–full-reset]
[–app-pkg APPPACKAGE] [–app-activity APPACTIVITY]
[–app-wait-package APPWAITPACKAGE]
[–app-wait-activity APPWAITACTIVITY]
[–device-ready-timeout DEVICEREADYTIMEOUT]
[–android-coverage ANDROIDCOVERAGE] [–avd AVD]
[–avd-args AVDARGS] [–use-keystore]
[–keystore-path KEYSTOREPATH]
[–keystore-password KEYSTOREPASSWORD] [–key-alias KEYALIAS]
[–key-password KEYPASSWORD] [–intent-action INTENTACTION]
[–intent-category INTENTCATEGORY] [–intent-flags INTENTFLAGS]
[–intent-args OPTIONALINTENTARGUMENTS]
[–dont-stop-app-on-reset] [–calendar-format CALENDARFORMAT]
[–native-instruments-lib] [–keep-keychains]
[–localizable-strings-dir LOCALIZABLESTRINGSDIR]
[–show-ios-log]

appium: error: argument “-g/–log”: Expected one argument. null
Menys-MacBook-Pro:~ menypeled$ npm install wd

[email protected] install /Users/menypeled/node_modules/wd
node scripts/build-browser-scripts

/Users/menypeled
└─┬ [email protected]
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ └─┬ [email protected]
│ └─┬ [email protected]
│ └─┬ [email protected]
│ └── [email protected]
├── [email protected]
├── [email protected]
├─┬ [email protected]
│ └── [email protected]
├── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └── [email protected]
│ │ │ ├── [email protected]
│ │ │ └── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ ├─┬ [email protected]
│ │ │ │ └── [email protected]
│ │ │ └── [email protected]
│ │ └─┬ [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├─┬ [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ ├── [email protected]
│ │ │ ├── [email protected]
│ │ │ └── [email protected]
│ │ └─┬ [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]
│ │ ├── [email protected]
│ │ ├── [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ └── [email protected]
├─┬ [email protected]
│ ├── [email protected]
│ └── [email protected]
└── [email protected]

npm WARN enoent ENOENT: no such file or directory, open ‘/Users/menypeled/package.json’
npm WARN menypeled No description
npm WARN menypeled No repository field.
npm WARN menypeled No README data
npm WARN menypeled No license field.
Menys-MacBook-Pro:~ menypeled$ npm install wd

[email protected] install /Users/menypeled/node_modules/wd
node scripts/build-browser-scripts

/Users/menypeled
└── [email protected]

npm WARN enoent ENOENT: no such file or directory, open ‘/Users/menypeled/package.json’
npm WARN menypeled No description
npm WARN menypeled No repository field.
npm WARN menypeled No README data
npm WARN menypeled No license field.
Menys-MacBook-Pro:~ menypeled$ appium &
[1] 3179
Menys-MacBook-Pro:~ menypeled$ [Appium] Welcome to Appium v1.6.4-beta
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
Menys-MacBook-Pro:~ menypeled$ clear

Menys-MacBook-Pro:~ menypeled$ [HTTP] → POST /wd/hub/session {“desiredCapabilities”:{“app”:“/Users/menypeled/Documents/workspace/iOS_Appium/SkyGiraffe.app”,“wdaLaunchTimeout”:10000,“xcodeOrgId”:“7Y5J2RJXYV”,“automationName”:“XCUITest”,“useNewWDA”:“true”,“udid”:“51d8c712258a5b0ac63516aa5be9d10014b0c270”,“platformName”:“iOS”,“deviceName”:“SG iPhone 5s”,“updatedWDABundleId”:“beta.SkyGiraffe.SkyGiraffe”,“wdaConnectionTimeout”:10000,“xcodeSigningId”:“iPhone Developer”}}
[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{“app”:“/Users/menypeled/Documents/workspace/iOS_Appium/SkyGiraffe.app”,“wdaLaunchTimeout”:10000,“xcodeOrgId”:“7Y5J2RJXYV”,“automationName”:“XCUITest”,“useNewWDA”:“true”,“udid”:“51d8c712258a5b0ac63516aa5be9d10014b0c270”,“platformName”:“iOS”,“deviceName”:“SG iPhone 5s”,“updatedWDABundleId”:“beta.SkyGiraffe.SkyGiraffe”,“wdaConnectionTimeout”:10000,“xcodeSigningId”:“iPhone Developer”},null,null,null,null]
[Appium] Creating new XCUITestDriver (v2.6.0) session
[Appium] Capabilities:
[Appium] app: ‘/Users/menypeled/Documents/workspace/iOS_Appium/SkyGiraffe.app’
[Appium] wdaLaunchTimeout: 10000
[Appium] xcodeOrgId: ‘7Y5J2RJXYV’
[Appium] automationName: ‘XCUITest’
[Appium] useNewWDA: ‘true’
[Appium] udid: ‘51d8c712258a5b0ac63516aa5be9d10014b0c270’
[Appium] platformName: ‘iOS’
[Appium] deviceName: ‘SG iPhone 5s’
[Appium] updatedWDABundleId: ‘beta.SkyGiraffe.SkyGiraffe’
[Appium] wdaConnectionTimeout: 10000
[Appium] xcodeSigningId: ‘iPhone Developer’
[debug] [XCUITest] XCUITestDriver version: 2.6.0
[BaseDriver] Capability ‘useNewWDA’ changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Session created with session id: 7039285c-2996-4408-8593-b70cb47cfd26
[debug] [XCUITest] Xcode version set to ‘8.2.1’
[debug] [XCUITest] iOS SDK Version set to ‘10.2’
[debug] [XCUITest] Available devices: 51d8c712258a5b0ac63516aa5be9d10014b0c270
[debug] [XCUITest] Creating iDevice object with udid 51d8c712258a5b0ac63516aa5be9d10014b0c270
[XCUITest] Determining device to run tests on: udid: ‘51d8c712258a5b0ac63516aa5be9d10014b0c270’, real device: true
[BaseDriver] Using local app ‘/Users/menypeled/Documents/workspace/iOS_Appium/SkyGiraffe.app’
[debug] [XCUITest] Checking whether app ‘/Users/menypeled/Documents/workspace/iOS_Appium/SkyGiraffe.app’ is actually present on file system
[debug] [XCUITest] App is present
[debug] [iOS] Getting bundle ID from app ‘/Users/menypeled/Documents/workspace/iOS_Appium/SkyGiraffe.app’: ‘beta.SkyGiraffe.SkyGiraffe’
[debug] [iOSLog] Attempting iOS device log capture via libimobiledevice idevicesyslog
[debug] [iOSLog] Found idevicesyslog: ‘/usr/local/bin/idevicesyslog’
[XCUITest] Setting up real device
[debug] [XCUITest] App is not installed. Will try to install.
[debug] [XCUITest] App installed successfully.
[XCUITest] Using WDA path: ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent’
[XCUITest] Using WDA agent: ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj’
[debug] [XCUITest] Capability ‘useNewWDA’ set, so uninstalling WDA before proceeding
[debug] [XCUITest] Removing WDA application from device
[XCUITest] Launching WebDriverAgent on the device
[debug] [XCUITest] Carthage found: ‘/usr/local/bin/carthage’
[debug] [XCUITest] Running WebDriverAgent bootstrap script to install dependencies
[debug] [XCUITest] Unable to launch WebDriverAgent because of xcodebuild failure: Command ‘/bin/bash Scripts/bootstrap.sh -d’ exited with code 1
[debug] [XCUITest] Quitting and uninstalling WebDriverAgent, then retrying
[XCUITest] Shutting down sub-processes
[debug] [XCUITest] Error resetting project file: ENOENT: no such file or directory, unlink ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj/project.pbxproj.old’
[XCUITest] Unable to reset project file ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj/project.pbxproj’ with bundle id ‘com.facebook.WebDriverAgentRunner’. WebDriverAgent has been modified and not returned to the original state.
[debug] [XCUITest] Removing WDA application from device
[XCUITest] Using WDA path: ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent’
[XCUITest] Using WDA agent: ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj’
[debug] [XCUITest] Capability ‘useNewWDA’ set, so uninstalling WDA before proceeding
[debug] [XCUITest] Removing WDA application from device
[XCUITest] Launching WebDriverAgent on the device
[debug] [XCUITest] Carthage found: ‘/usr/local/bin/carthage’
[debug] [XCUITest] Running WebDriverAgent bootstrap script to install dependencies
[debug] [XCUITest] Unable to launch WebDriverAgent because of xcodebuild failure: Command ‘/bin/bash Scripts/bootstrap.sh -d’ exited with code 1
[debug] [XCUITest] Quitting and uninstalling WebDriverAgent, then retrying
[XCUITest] Shutting down sub-processes
[debug] [XCUITest] Error resetting project file: ENOENT: no such file or directory, unlink ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj/project.pbxproj.old’
[XCUITest] Unable to reset project file ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj/project.pbxproj’ with bundle id ‘com.facebook.WebDriverAgentRunner’. WebDriverAgent has been modified and not returned to the original state.
[debug] [XCUITest] Removing WDA application from device
[XCUITest] Using WDA path: ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent’
[XCUITest] Using WDA agent: ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj’
[debug] [XCUITest] Capability ‘useNewWDA’ set, so uninstalling WDA before proceeding
[debug] [XCUITest] Removing WDA application from device
[XCUITest] Launching WebDriverAgent on the device
[debug] [XCUITest] Carthage found: ‘/usr/local/bin/carthage’
[debug] [XCUITest] Running WebDriverAgent bootstrap script to install dependencies
[XCUITest] Error: Command ‘/bin/bash Scripts/bootstrap.sh -d’ exited with code 1
at ChildProcess. (…/…/lib/teen_process.js:70:19)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:885:16)
at Socket. (internal/child_process.js:334:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:501:12)
{ Error: Command ‘/bin/bash Scripts/bootstrap.sh -d’ exited with code 1
at ChildProcess. (…/…/lib/teen_process.js:70:19)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:885:16)
at Socket. (internal/child_process.js:334:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:501:12)
stdout: ‘\u001b[1mFetching dependencies\n’,
stderr: ‘Error: Command “bootstrap” does not exist.\n’,
code: 1 }
[debug] [XCUITest] Running ios real device reset flow
[debug] [iOSLog] Stopping iOS log capture
[MJSONWP] Encountered internal error running command: Error: Command ‘/bin/bash Scripts/bootstrap.sh -d’ exited with code 1
at ChildProcess. (…/…/lib/teen_process.js:70:19)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:885:16)
at Socket. (internal/child_process.js:334:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:501:12)
[HTTP] ← POST /wd/hub/session 500 13643 ms - 199

1 Like

@menypeled please file issue in appium github repo in stated format.

Thanks,
Vikram

Did you try

cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
brew install carthage
npm i -g webpack
./Scripts/bootstrap.sh -d

carthage was installed already,
I ran the npm i -g webpack.
However the command “./Scripts/bootstrap.sh -d” is failing with the below error.
In addition when running the test on the iPhone it still gets the origin error I reported.

Menys-MacBook-Pro:~ menypeled$ cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
Menys-MacBook-Pro:WebDriverAgent menypeled$ ./Scripts/bootstrap.sh -d
Fetching dependencies
Error: Command “bootstrap” does not exist.

I see the issue with this particular part :slight_smile:
[XCUITest] Error resetting project file: ENOENT: no such file or directory, unlink ‘/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj/project.pbxproj.old’

seesm its is unable to locate the bundle id / app path properly for the launch. Can you verify?

Bundle id is set & app path as well (the app is installed after all…)

[debug] [MJSONWP] Calling AppiumDriver.createSession() with args: [{“app”:"/Users/menypeled/Documents/workspace/iOS_Appium/SkyGiraffe.app",“wdaLaunchTimeout”:10000,“xcodeOrgId”:“7Y5J2RJXYV”,“bundleId”:“beta.SkyGiraffe.SkyGiraffe”,“automationName”:“XCUITest”,“useNewWDA”:“true”,“udid”:“51d8c712258a5b0ac63516aa5be9d10014b0c270”,“platformName”:“iOS”,“deviceName”:“SG iPhone 5s”,“updatedWDABundleId”:“beta.SkyGiraffe.SkyGiraffe”,“wdaConnectionTimeout”:10000,“xcodeSigningId”:“iPhone Developer”},null,null,null,null]
[Appium] Creating new XCUITestDriver (v2.6.0) session

Can you confirm which version of xocde you are using with sierra OS?
should work with xcode version 8.2 for iOS 10. There can be an issue with the xcode version not supported and hence app not getting launched properly. Also , check whether you have JDK 1.8 added in your JAVA_HOME in your mac machine because latest JAVA 8 is required .

Was able to launch iOS on real device eventually.
The below guide was the solution:

1 Like