Appium, starting iOS simulator

I use xCode 7.0.1, Mac OSx Yosemite, appium 1.4.8
I cannot get simulator executed when running script

desired_caps = {
caps: {
platformName: ‘iOS’,
platformVersion: ‘8.4’,
#deviceName: ‘=9CE78145-8F07-43B0-916E-09D170AC6890’,
deviceName: ‘iPhone 6’,
browserName: ‘Safari’,

}

}

When I put just name as iPhone 6, then I get error:
info: Client User-Agent string: appium/ruby_lib/8.0.0

info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************

info: [debug] Configuring Safari session
info: [debug] We’re on iOS8+ so not copying mobile safari app
info: [debug] Creating new appium session 3c279e84-ae4a-4a0c-a2a8-79042a128c87
info: [debug] Removing any remaining instruments sockets

info: [debug] Cleaned up instruments socket /tmp/instruments_sock
info: [debug] Setting Xcode version

info: [debug] Xcode version set to 7.0.1

info: [debug] Setting iOS SDK Version
info: [debug] iOS SDK Version set to 9.0
info: [debug] Checking whether instruments supports our device string
info: [debug] Getting list of devices instruments supports

info: [debug] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments

info: [debug] Getting device string from opts: {“forceIphone”:false,“forceIpad”:false,“xcodeVersion”:“7.0.1”,“iOSSDKVersion”:“9.0”,“deviceName”:“iPhone 6”,“platformVersion”:“8.4”}

info: [debug] fixDevice is on
info: [debug] Final device string is: ‘iPhone (8.4 Simulator)’

error: Could not find a device to launch. You requested ‘iPhone (8.4 Simulator)’, but the available devices were: [“iPad 2 (8.1) [C6B26B71-F675-4BA5-A6F1-41281A1A7B9A]”,“iPad 2 (8.2) [59DC52FE-241D-40F8-A2A5-DB070619A82A]”,“iPad 2 (8.3) [EF06E071-F0A6-4562-BD28-BBB975C4608F]”,“iPad 2 (8.4) [0A653747-0709-429C-A818-5F5AE6682F29]”,“iPad 2 (9.0) [CD528EDD-A8F2-45F2-A50A-C0B6C0FBBACC]”,“iPad Air (8.1) [AD83B2D6-1DCD-43D2-9B16-673AD15E0C00]”,“iPad Air (8.2) [3BDD579E-9F37-4F59-B7FE-1702CD23DECC]”,“iPad Air (8.3) [5E04C1F6-EF5D-43DE-9EE4-2D185C642DFA]”,“iPad Air (8.4) [17FFC143-E35A-4F4A-A5E5-8A59520FF50E]”,“iPad Air (9.0) [1665A4EC-B38B-44B0-B5C8-991E8FCA52B1]”,“iPad Air 2 (9.0) [81F5B07B-2CB0-44B4-BA1B-836F4A99924F]”,“iPad Retina (8.1) [F6CF74CA-D0F0-469E-AAE7-58215F0D8FD3]”,“iPad Retina (8.2) [CBE51D9F-1105-4A0B-BF82-D2857BB11F35]”,“iPad Retina (8.3) [A564A287-9344-4A27-AD8A-0B18BA99F492]”,“iPad Retina (8.4) [FAA56C13-A2FA-4E97-AF72-94031FAEC653]”,“iPad Retina (9.0) [2CB24A42-4C5E-452C-951C-A93D51FBA6E6]”,“iPhone 4s (8.1) [D6A136DF-B931-463E-8BC3-78692A8588B6]”,“iPhone 4s (8.2) [3B359F15-3C2D-4B57-BE55-DDEDCD304833]”,“iPhone 4s (8.3) [408FF419-1DBE-4D73-B5E2-35281F863D7C]”,“iPhone 4s (8.4) [509F3F74-A93E-449D-8880-31FDB1EEA21B]”,“iPhone 4s (9.0) [90ED3498-2C2E-4BE3-8720-4D2AC5E69C47]”,“iPhone 5 (8.1) [68545F71-8E4A-48DA-9B1B-08E71974A2EB]”,“iPhone 5 (8.2) [024951FD-EB31-47BB-B3BC-C7B5BCFD69DB]”,“iPhone 5 (8.3) [6416DE15-DA11-4DE5-9148-5EE13465F476]”,“iPhone 5 (8.4) [85AA3738-988E-4114-8D2F-BBC95CAE053C]”,“iPhone 5 (9.0) [4CA8D8FD-E697-4112-BEC0-FA589FDEA833]”,“iPhone 5s (8.1) [CBBCC352-C157-4B30-BCF1-5E78EE3F52A6]”,“iPhone 5s (8.2) [11B6D8A3-3C79-4C6D-8712-C26FE20E7440]”,“iPhone 5s (8.3) [F5BBEAAD-AC72-4579-AEBD-DDD52FE42A45]”,“iPhone 5s (8.4) [CD243DED-3556-4DF8-9BE6-138E41DDA2C8]”,“iPhone 5s (9.0) [5912DC3D-85B3-42A0-ABB9-9B2B3C61F28F]”,“iPhone 6 (8.1) [336CFBCF-324C-4E94-B728-A4B98BCEFFD0]”,“iPhone 6 (8.2) [88CEF367-A7D3-451F-9CBB-402CB633EBC2]”,“iPhone 6 (8.3) [0E471F40-CF34-4D52-A3F2-FD317F3C1DB5]”,“iPhone 6 (8.4) [7958A849-ECE7-47A8-9F17-AC7977D9A383]”,“iPhone 6 (9.0) [9CE78145-8F07-43B0-916E-09D170AC6890]”,“iPhone 6 (9.0) + Apple Watch - 38mm (2.0) [CEE4F75C-63D4-494C-B127-603AED1B81A3]”,“iPhone 6 Plus (8.1) [52EB95E9-D3C5-4F5C-8E2D-9CBC6736B7F1]”,“iPhone 6 Plus (8.2) [7CE3C199-043D-4F58-9319-51CBBCB67B12]”,“iPhone 6 Plus (8.3) [73A9404D-0D0F-463B-A9C3-863D32BE880C]”,“iPhone 6 Plus (8.4) [A98A1CE2-1DB7-48D9-89F3-77FD7BB5CF22]”,“iPhone 6 Plus (9.0) [D9C770F5-AF2D-407A-9929-384670D46751]”,“iPhone 6 Plus (9.0) + Apple Watch - 42mm (2.0) [36C80892-A131-461B-A9E6-2DC1E989A64F]”,“iPhone 6s (9.0) [6231CFBB-EC26-48CB-8D4B-93AF22710C2F]”,“iPhone 6s Plus (9.0) [2473C8B6-8AFD-4D6A-B832-4883CE088629]”]

if I put just name as GUID, then I get another error:
info: [debug] Configuring Safari session
info: [debug] We’re on iOS8+ so not copying mobile safari app
info: [debug] Creating new appium session 16c4d639-3316-47ba-9d66-7d79af723121

info: [debug] Removing any remaining instruments sockets
info: [debug] Cleaned up instruments socket /tmp/instruments_sock
info: [debug] Setting Xcode version

info: [debug] Xcode version set to 7.0.1

info: [debug] Setting iOS SDK Version

info: [debug] iOS SDK Version set to 9.0
info: [debug] Checking whether instruments supports our device string
info: [debug] Getting list of devices instruments supports
info: [debug] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments

info: [debug] Getting device string from opts: {“forceIphone”:false,“forceIpad”:false,“xcodeVersion”:“7.0.1”,“iOSSDKVersion”:“9.0”,“deviceName”:"=9CE78145-8F07-43B0-916E-09D170AC6890",“platformVersion”:“8.4”}

info: [debug] iOS sim UDID is 9CE78145-8F07-43B0-916E-09D170AC6890
info: [debug] Auto-detecting iOS udid…
info: [debug] Not auto-detecting udid, running on sim
info: [debug] Localizable.strings is not currently supported when using real devices.
info: [debug] Creating instruments

info: [debug] Preparing uiauto bootstrap
info: [debug] Dynamic bootstrap dir: /Users/dennisdem/Library/Application Support/appium/bootstrap
info: [debug] Dynamic env: {“nodePath”:"/Applications/Appium.app/Contents/Resources/node/bin/node",“commandProxyClientPath”:"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js",“instrumentsSock”:"/tmp/instruments_sock",“interKeyDelay”:null,“justLoopInfinitely”:false,“autoAcceptAlerts”:false,“autoDismissAlerts”:false,“sendKeyStrategy”:“oneByOne”}

info: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!

info: [debug] Dynamic bootstrap path: /Users/dennisdem/Library/Application Support/appium/bootstrap/bootstrap-4e580d338a12229a.js

info: [debug] Reusing dynamic bootstrap: /Users/dennisdem/Library/Application Support/appium/bootstrap/bootstrap-4e580d338a12229a.js
info: [debug] Getting device string from opts: {“forceIphone”:false,“forceIpad”:false,“xcodeVersion”:“7.0.1”,“iOSSDKVersion”:“9.0”,“deviceName”:"=9CE78145-8F07-43B0-916E-09D170AC6890",“platformVersion”:“8.4”}
info: [debug] Not setting device type since we’re using bundle ID and assuming app is already installed
info: [debug] Checking whether we need to set app preferences
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 9CE78145-8F07-43B0-916E-09D170AC6890 with timeout 2000

info: [debug] Cleaning mobile safari data files

warn: Applications directory /Users/dennisdem/Library/Developer/CoreSimulator/Devices/9CE78145-8F07-43B0-916E-09D170AC6890/data/Containers/Data/Application doesn’t exist. Have you run this simulator before?
info: [debug] Deleting /Users/dennisdem/Library/Developer/CoreSimulator/Devices/9CE78145-8F07-43B0-916E-09D170AC6890/data/Library/Caches/Snapshots/com.apple.mobilesafari

info: [debug] Deleting /Users/dennisdem/Library/Developer/CoreSimulator/Devices/9CE78145-8F07-43B0-916E-09D170AC6890/data/Library/Caches/com.apple.mobilesafari/Cache.db*
info: [debug] Deleting /Users/dennisdem/Library/Developer/CoreSimulator/Devices/9CE78145-8F07-43B0-916E-09D170AC6890/data/Library/Caches/com.apple.WebAppCache/.db
info: [debug] Deleting /Users/dennisdem/Library/Developer/CoreSimulator/Devices/9CE78145-8F07-43B0-916E-09D170AC6890/data/Library/Safari
info: [debug] Deleting /Users/dennisdem/Library/Developer/CoreSimulator/Devices/9CE78145-8F07-43B0-916E-09D170AC6890/data/Library/WebKit/LocalStorage/
.*
info: [debug] Deleting /Users/dennisdem/Library/Developer/CoreSimulator/Devices/9CE78145-8F07-43B0-916E-09D170AC6890/data/Library/WebKit/GeolocationSites.plist
info: [debug] Deleting /Users/dennisdem/Library/Developer/CoreSimulator/Devices/9CE78145-8F07-43B0-916E-09D170AC6890/data/Library/Cookies/.binarycookies
info: [debug] Not setting locale
info: [debug] No iOS / app preferences to set
info: [debug] Starting iOS 8.
simulator log capture

info: [debug] Not pre-launching simulator

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 9CE78145-8F07-43B0-916E-09D170AC6890
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 9CE78145-8F07-43B0-916E-09D170AC6890 com.apple.mobilesafari -e UIASCRIPT “/Users/dennisdem/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/iwd7/InstrumentsShim.dylib",“LIB_PATH”:"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd7"}
info: [debug] And launch timeouts (in ms): {“global”:90000}

info: [debug] [INST STDERR] dyld: could not load inserted library ‘/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib’ because no suitable image found. Did find:
/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib: mmap() error 1 at address=0x10A470000, size=0x00001000 segment=__TEXT in Segment::map() mapping /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib

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

info: [debug] Killall instruments

info: [debug] Instruments crashed on startup
info: [debug] Attempting to retry launching instruments, this is retry #1
info: [debug] Killall iOS Simulator

Any ideas on resolving such dilemma?

@denka

  1. Are you on the latest Appium version?
  2. Are you sure that your app is built for the simulator?

Hi, I use appium 1.4.8 and I am trying to use web, not app. Just trying to get to the browser and load website for me

Hey there
I think you need to update your platformVersion to 9.0 (double check the dot version in the devices menu in the standalone iOS simulator app)

According to your logs, it’s failing because appium cannot find your 8.4 simulator version.

-Eric

@shermaneric Hmm, when I check xcode and appium, I do not see version 9 in Appium for dropdown, but xcode shows


Imgur

how do I get it?

just did the change and keep getting

[INST STDERR] dyld: could not load inserted library ‘/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib’ because no suitable image found. Did find:
/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib: mmap() error 1 at address=0x104729000, size=0x00001000 segment=__TEXT in Segment::map() mapping /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib

You need to use at least Appium 1.4.11 with Xcode 7:

@wreed I do not see 1.4.11 version under downloads?

Imgur

I tried 1.4.13, but it was glitching about new update to version 1.4.8

followed and it did try to upgrade to 1.4.13

I removed 1.4.8 and installed 1.4.13 version
tried to set Platform version 9.0 and 8.4 with corresponding UDIDs, taken from Xcode and still getting error
info: [debug] iOS sim UDID is 7958A849-ECE7-47A8-9F17-AC7977D9A383
info: [debug] Auto-detecting iOS udid…
info: [debug] Not auto-detecting udid, running on sim
info: [debug] Localizable.strings is not currently supported when using real devices.
info: [debug] Creating instruments

info: [debug] Preparing uiauto bootstrap
info: [debug] Dynamic bootstrap dir: /Users/dennisdem/Library/Application Support/appium/bootstrap
info: [debug] Dynamic env: {“nodePath”:"/Applications/Appium.app/Contents/Resources/node/bin/node",“commandProxyClientPath”:"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js",“instrumentsSock”:"/tmp/instruments_sock",“interKeyDelay”:null,“justLoopInfinitely”:false,“autoAcceptAlerts”:false,“autoDismissAlerts”:false,“sendKeyStrategy”:“oneByOne”}

info: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!

info: [debug] Dynamic bootstrap path: /Users/dennisdem/Library/Application Support/appium/bootstrap/bootstrap-4e580d338a12229a.js
info: [debug] Reusing dynamic bootstrap: /Users/dennisdem/Library/Application Support/appium/bootstrap/bootstrap-4e580d338a12229a.js
info: [debug] Getting device string from opts: {“forceIphone”:false,“forceIpad”:false,“xcodeVersion”:“7.0.1”,“iOSSDKVersion”:“9.0”,“deviceName”:"=7958A849-ECE7-47A8-9F17-AC7977D9A383",“platformVersion”:“8.4”}
info: [debug] Not setting device type since we’re using bundle ID and assuming app is already installed
info: [debug] Checking whether we need to set app preferences
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 7958A849-ECE7-47A8-9F17-AC7977D9A383 with timeout 2000

info: [debug] Cleaning mobile safari data files

warn: Applications directory /Users/dennisdem/Library/Developer/CoreSimulator/Devices/7958A849-ECE7-47A8-9F17-AC7977D9A383/data/Containers/Data/Application doesn’t exist. Have you run this simulator before?
info: [debug] Deleting /Users/dennisdem/Library/Developer/CoreSimulator/Devices/7958A849-ECE7-47A8-9F17-AC7977D9A383/data/Library/Caches/Snapshots/com.apple.mobilesafari
info: [debug] Deleting /Users/dennisdem/Library/Developer/CoreSimulator/Devices/7958A849-ECE7-47A8-9F17-AC7977D9A383/data/Library/Caches/com.apple.mobilesafari/Cache.db*
info: [debug] Deleting /Users/dennisdem/Library/Developer/CoreSimulator/Devices/7958A849-ECE7-47A8-9F17-AC7977D9A383/data/Library/Caches/com.apple.WebAppCache/*.db
info: [debug] Deleting /Users/dennisdem/Library/Developer/CoreSimulator/Devices/7958A849-ECE7-47A8-9F17-AC7977D9A383/data/Library/Safari

info: [debug] Deleting /Users/dennisdem/Library/Developer/CoreSimulator/Devices/7958A849-ECE7-47A8-9F17-AC7977D9A383/data/Library/WebKit/LocalStorage/.
info: [debug] Deleting /Users/dennisdem/Library/Developer/CoreSimulator/Devices/7958A849-ECE7-47A8-9F17-AC7977D9A383/data/Library/WebKit/GeolocationSites.plist
info: [debug] Deleting /Users/dennisdem/Library/Developer/CoreSimulator/Devices/7958A849-ECE7-47A8-9F17-AC7977D9A383/data/Library/Cookies/.binarycookies
info: [debug] Not setting locale
info: [debug] No iOS / app preferences to set
info: [debug] Starting iOS 8.
simulator log capture

info: [debug] Not pre-launching simulator

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 7958A849-ECE7-47A8-9F17-AC7977D9A383
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 7958A849-ECE7-47A8-9F17-AC7977D9A383 com.apple.mobilesafari -e UIASCRIPT “/Users/dennisdem/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/iwd7/InstrumentsShim.dylib",“LIB_PATH”:"/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd7"}
info: [debug] And launch timeouts (in ms): {“global”:90000}
info: [debug] [INST STDERR] dyld: could not load inserted library ‘/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib’ because no suitable image found. Did find:
/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib: mmap() error 1 at address=0x10331E000, size=0x00001000 segment=__TEXT in Segment::map() mapping /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/appium-instruments/thirdparty/iwd7/InstrumentsShim.dylib

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

I got Appium to work. Interesting that when I use inspector and use record, anything I do I get element set to name only which always null

	wd.findElement(By.name("(null)")).click();
	wd.close();
}

Is there a way to switch xpath selector?

How did you get appium to work? Can you please post your solution here?

@alangithubtrader I did install v1.4.8, then copied node_module to another location from Appium/Contents/Resources/node_modules/appium/
Then I uninstalled 1.4.8 and installed 1.4.13 and pasted that node_modules folder over to replace and it did the trick for me.

1 Like