Search code examples
iosiphonexcodeappiumpython-appium

Appium tries to launch app on simulator instead of real device


appium : 1.4.13

xcode : 7.1

ios: 9.1

desired_caps = dict()
            desired_caps['platformName'] = 'iOS'
            desired_caps['platformVersion'] = '9.1'
            desired_caps['deviceName'] = 'iPhone 6'
            desired_caps['app'] = os.path.abspath('/Users/Test.app')
            self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)

It always lauches simulator even though real device is attached.

I am trying to run on device.

And simulator keeps lauching and shutting down.

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 iPhone 6 (9.1) [
info: On xcode 7.0, instruments-without-delay does not work, skippinginstruments-without-delay
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 6 (9.1) [" /Users/Test.app -e UIASCRIPT "/Users/Library/Application Support/appium/bootstrap/bootstrap-bf740a9394e481ef.js" -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And launch timeouts (in ms): {"global":90000}
info: [debug] [INST] Waiting for device to boot...
info: [debug] [INST STDERR] 2015-10-21 13:29:31.895 instruments[3192:50268] WebKit Threading Violation - initial use of WebKit from a secondary thread.
info: [debug] [INST STDERR] 2015-10-21 13:29:53.976 instruments[3192:50261] Attempting to change event horizon while disengage
info: [debug] [INST STDERR] 2015-10-21 13:29:53.976 instruments[3192:51306] Attempting to change event horizon while disengage
info: [debug] [INST STDERR] Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 1.) : Failed to launch process with bundle identifier 'com.apsalar.sdkBatchTest2'
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 #1
info: [debug] Killall Simulator
info: Launching instruments
info: [debug] Attempting to run app on iPhone 6 (9.1) [
info: On xcode 7.0, instruments-without-delay does not work, skippinginstruments-without-delay
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 6 (9.1) [" /Users/Test.app -e UIASCRIPT "/Users/Library/Application Support/appium/bootstrap/bootstrap-bf740a9394e481ef.js" -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And launch timeouts (in ms): {"global":90000}
info: [debug] [INST STDERR] 2015-10-21 13:30:00.033 instruments[3298:51578] **WebKit Threading Violation - initial use of WebKit from a secondary thread.**
info: [debug] [INST] Waiting for device to boot...
info: [debug] [INST STDERR] 2015-10-21 13:30:07.851 instruments[3298:51576] Attempting to change event horizon while disengage
info: [debug] [INST STDERR] 2015-10-21 13:30:07.851 instruments[3298:51577] Attempting to change event horizon while disengage
info: [debug] [INST STDERR] Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 1.) : Failed to launch process with bundle identifier 'com.apsalar.sdkBatchTest2'
info: [debug] [INSTSERVER] Instruments exited with code 253
info: [debug] Killall instruments

Solution

  • Add "udid" capability and enter your device udid there.

    capabilities.setCapability("deviceName", "phoneUDID");