I am trying out automation for IOS simulator with Appium and webdriverio.
Appium is creating simulator with random simulator name like 'appiumTest-4F75F52A-4C52-48F0-B818-60C891F72E95-iPhone XR'.
It is creating number of simulators according the number of tests which has been written. I am trying to figure out why appium is creating instances of the simulators.
Desired capabilities for the test:
capabilities: [{
maxInstances: 1,
deviceName: 'iPhone XR',
platformName: 'iOS',
app: 'app/path',
platformVersion: '12.2',
orientation: 'PORTRAIT',
noReset: true,
automationName: 'XCUITest',
useNewWDA: true,
waitForQuiescence: false,
newCommandTimeout: 240,
}]
Given is the APPIUM log of the test for Ios simulator
[35m[BaseDriver][39m Session created with session id: 6caa6127-91ad-4770-9e6b-6adbbcfbf000
[debug]
[35m[XCUITest][39m iOS SDK Version set to '12.2'
[35m[XCUITest][39m Simulator udid not provided
[35m[XCUITest][39m Using desired caps to create a new simulator
[debug] [35m[simctl][39m Creating simulator with name 'appiumTest-4F76F52A-4C52-48F0-B818-60C891F72E95-iPhone XR', device type id 'iPhone XR' and runtime id 'com.apple.CoreSimulator.SimRuntime.iOS-12-2'
[35m[iOSSim][39m Constructing iOS simulator for Xcode version 10.2.1 with udid '82827AFA-6BE5-4CCF-9506-CB866477427B'
[35m[XCUITest][39m Created simulator with udid '82827AFA-6BE5-4CCF-9506-CB866477427B'.
[35m[XCUITest][39m Determining device to run tests on: udid: '82827AFA-6BE5-4CCF-9506-CB866477427B', real device: false
[debug] [35m[BaseDriver][39m Event 'xcodeDetailsRetrieved' logged at 1562754343205 (15:55:43 GMT+0530 (India Standard Time))
[35m[BaseDriver][39m Using local app '/Users/faizahmed/Downloads/wdio-mobile/wdioApp/iOS-Simulator-NativeDemoApp-0.2.1.app.zip'
[debug] [35m[BaseDriver][39m Unzipping '/Users/faizahmed/Downloads/wdio-mobile/wdioApp/iOS-Simulator-NativeDemoApp-0.2.1.app.zip'
[debug] [35m[BaseDriver][39m Extracted 84 item(s) from '/Users/faizahmed/Downloads/wdio-mobile/wdioApp/iOS-Simulator-NativeDemoApp-0.2.1.app.zip'
[debug] [35m[BaseDriver][39m Matched 84 item(s) in the extracted archive. Assuming 'iOS-Simulator-NativeDemoApp-0.2.1.app' is the correct bundle
[35m[BaseDriver][39m Unzipped local app to '/var/folders/0v/qnp0rbs13j59m597p5ff016c0000gn/T/2019610-76637-1yhuqt3.dn1ul/iOS-Simulator-NativeDemoApp-0.2.1.app'
[debug] [35m[BaseDriver][39m Event 'appConfigured' logged at 1562754343822 (15:55:43 GMT+0530 (India Standard Time))
[debug] [35m[XCUITest][39m Checking whether app '/var/folders/0v/qnp0rbs13j59m597p5ff016c0000gn/T/2019610-76637-1yhuqt3.dn1ul/iOS-Simulator-NativeDemoApp-0.2.1.app' is actually present on file system
[debug] [35m[XCUITest][39m App is present
[debug] [35m[iOS][39m Getting bundle ID from app '/var/folders/0v/qnp0rbs13j59m597p5ff016c0000gn/T/2019610-76637-1yhuqt3.dn1ul/iOS-Simulator-NativeDemoApp-0.2.1.app': 'org.reactjs.native.example.wdioDemoApp'
[debug] [35m[BaseDriver][39m Event 'resetStarted' logged at 1562754343826 (15:55:43 GMT+0530 (India Standard Time))
[debug] [35m[XCUITest][39m Reset: noReset is on. Leaving simulator as is
[debug] [35m[BaseDriver][39m Event 'resetComplete' logged at 1562754343827 (15:55:43 GMT+0530 (India Standard Time))
[35m[XCUITest][39m Continuing without capturing device logs: iOS Simulator with udid 82827AFA-6BE5-4CCF-9506-CB866477427B is not running
[35m[XCUITest][39m Setting up simulator
[debug] [35m[iOS][39m No reason to set locale
[debug] [35m[iOS][39m No iOS / app preferences to set
[debug] [35m[iOS][39m Setting did not need to be updated
[debug] [35m[iOSSim][39m Setting preferences of 82827AFA-6BE5-4CCF-9506-CB866477427B Simulator to {"SimulatorWindowOrientation":"Portrait","SimulatorWindowRotationAngle":0,"ConnectHardwareKeyboard":false}
[debug] [35m[iOSSim][39m Setting common Simulator preferences to {"RotateWindowWhenSignaledByGuest":true,"ConnectHardwareKeyboard":false}
[debug] [35m[iOSSim][39m Updated 82827AFA-6BE5-4CCF-9506-CB866477427B Simulator preferences at '/Users/faizahmed/Library/Preferences/com.apple.iphonesimulator.plist' with {"DevicePreferences":{"82827AFA-6BE5-4CCF-9506-CB866477427B":{"SimulatorWindowOrientation":"Portrait","SimulatorWindowRotationAngle":0,"ConnectHardwareKeyboard":false}},"RotateWindowWhenSignaledByGuest":true,"ConnectHardwareKeyboard":false}
[35m[iOSSim][39m Booting Simulator with UDID 82827AFA-6BE5-4CCF-9506-CB866477427B...
[35m[iOSSim][39m Starting Simulator UI with command: open -Fn /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app --args -CurrentDeviceUDID 82827AFA-6BE5-4CCF-9506-CB866477427B -ConnectHardwareKeyboard 0
[35m[iOSSim][39m Simulator with UDID 82827AFA-6BE5-4CCF-9506-CB866477427B booted in 20 seconds
[debug] [35m[IDB][39m Connecting idb service to '82827AFA-6BE5-4CCF-9506-CB866477427B'
[35m[XCUITest][39m idb will not be used for Simulator interaction. Original error: 'idb' has not been found in PATH. Is it installed? Read https://www.fbidb.io for more details
[debug] [35m[BaseDriver][39m Event 'simStarted' logged at 1562754364973 (15:56:04 GMT+0530 (India Standard Time))
[debug] [35m[XCUITest][39m Starting log capture for iOS Simulator with udid '82827AFA-6BE5-4CCF-9506-CB866477427B', using 'xcrun simctl spawn 82827AFA-6BE5-4CCF-9506-CB866477427B log stream --style compact'
[debug]
[debug] [35m[XCUITest][39m Verifying application platform
[debug] [35m[XCUITest][39m CFBundleSupportedPlatforms: ["iPhoneSimulator"]
[debug] [35m[XCUITest][39m Cleaning installd cache to save the disk space
[debug] [35m[XCUITest][39m Installing '/var/folders/0v/qnp0rbs13j59m597p5ff016c0000gn/T/2019610-76637-1yhuqt3.dn1ul/iOS-Simulator-NativeDemoApp-0.2.1.app' on Simulator with UUID '82827AFA-6BE5-4CCF-9506-CB866477427B'...
[debug] [35m[XCUITest][39m The app has been installed successfully.
[debug] [35m[BaseDriver][39m Event 'appInstalled' logged at 1562754373051 (15:56:13 GMT+0530 (India Standard Time))
[35m[XCUITest][39m Using WDA path: '/Users/faizahmed/Downloads/appium-mobile-test/node_modules/appium-webdriveragent'
[35m[XCUITest][39m Using WDA agent: '/Users/faizahmed/Downloads/appium-mobile-test/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj'
[debug] [35m[XCUITest][39m No obsolete cached processes from previous WDA sessions listening on port 8100 have been found
[debug] [35m[XCUITest][39m Starting WebDriverAgent initialization with the synchronization key 'XCUITestDriver'
[debug] [35m[XCUITest][39m Capability 'useNewWDA' set to true, so uninstalling WDA before proceeding
[35m[XCUITest][39m Shutting down sub-processes
[debug] [35m[XCUITest][39m Removing WDA application from device
[debug] [35m[BaseDriver][39m Event 'wdaUninstalled' logged at 1562754375211 (15:56:15 GMT+0530 (India Standard Time))
[debug] [35m[XCUITest][39m Trying to start WebDriverAgent 2 times with 10000ms interval
[debug] [35m[XCUITest][39m These values can be customized by changing wdaStartupRetries/wdaStartupRetryInterval capabilities
[debug] [35m[BaseDriver][39m Event 'wdaStartAttempted' logged at 1562754375212 (15:56:15 GMT+0530 (India Standard Time))
[35m[XCUITest][39m Launching WebDriverAgent on the device
[35m[WebDriverAgent][39m Fetching dependencies
[35m[WebDriverAgent][39m Dependencies up-to-date
[debug] [35m[XCUITest][39m Killing running processes 'xcodebuild.*82827AFA-6BE5-4CCF-9506-CB866477427B, 82827AFA-6BE5-4CCF-9506-CB866477427B.*XCTRunner' for the device 82827AFA-6BE5-4CCF-9506-CB866477427B...
[debug] [35m[XCUITest][39m 'pgrep -ifn xcodebuild.*82827AFA-6BE5-4CCF-9506-CB866477427B' didn't detect any matching processes. Return code: 1
[debug] [35m[XCUITest][39m 'pgrep -ifn 82827AFA-6BE5-4CCF-9506-CB866477427B.*XCTRunner' didn't detect any matching processes. Return code: 1
[debug] [35m[XCUITest][39m Beginning test with command 'xcodebuild build-for-testing test-without-building -project /Users/faizahmed/Downloads/appium-mobile-test/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=82827AFA-6BE5-4CCF-9506-CB866477427B IPHONEOS_DEPLOYMENT_TARGET=12.2 GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO' in directory '/Users/faizahmed/Downloads/appium-mobile-test/node_modules/appium-webdriveragent'
Related
I'm trying to inspect the elements of the IntegrationApp.app that comes with the WebDriverAgent project. I built the app on a simulator in xcode but when I:
Open Appium Desktop (v1.15.1) on my MAC (v10.14.6)
Start the server
Select Start Inspector Session magnifying glass icon in the top right corner of the appium window
Provide the following capability set:
{
"automationName": "XCUITest",
"platformName": "iOS",
"deviceName": "iPad Air (3rd generation)",
"platformVersion": "13.1",
"app": "/Users/[MAC_USER]/Desktop/IntegrationApp.app"
}
Start the session
The simulator boots up and then Appium Desktop terminates leaving the ios simulator open without the app being installed. Has anyone encountered similar issues? Any thoughts what could be causing the issue? When running xcrun simctl list it lists the model. Below are the appium logs:
[info] [35m[Appium][39m Non-default server args:
[info] [35m[Appium][39m allowInsecure: {
[info] [35m[Appium][39m }
[info] [35m[Appium][39m denyInsecure: {
[info] [35m[Appium][39m }
[info] [35m[Appium][39m Appium REST http interface listener started on 0.0.0.0:4723[info] [35m[HTTP][39m [37m-->[39m [37mPOST[39m [37m/wd/hub/session[39m
[info] [35m[HTTP][39m [90m{"desiredCapabilities":{"app":"/Users/testuser/Desktop/IntegrationApp.app","automationName":"XCUITest","deviceName":"iPad Air (3rd generation)","platformName":"iOS","platformVersion":"13.1","newCommandTimeout":0,"connectHardwareKeyboard":true}}[39m
[debug] [35m[MJSONWP][39m Calling AppiumDriver.createSession() with args: [{"app":"/Users/testuser/Desktop/IntegrationApp.app","automationName":"XCUITest","deviceName":"iPad Air (3rd generation)","platformName":"iOS","platformVersion":"13.1","newCommandTimeout":0,"connectHardwareKeyboard":true},null,null]
[debug] [35m[BaseDriver][39m Event 'newSessionRequested' logged at 1574244116561 (10:01:56 GMT+0000 (GMT))
[info] [Appium] Appium v1.15.1 creating new XCUITestDriver (v2.133.1) session
[debug] [BaseDriver] Creating session with MJSONWP desired capabilities: {
[debug] [BaseDriver] "app": "/Users/testuser/Desktop/IntegrationApp.app",
[debug] [BaseDriver] "automationName": "XCUITest",
[debug] [BaseDriver] "deviceName": "iPad Air (3rd generation)",
[debug] [BaseDriver] "platformName": "iOS",
[debug] [BaseDriver] "platformVersion": "13.1",
[debug] [BaseDriver] "newCommandTimeout": 0,
[debug] [BaseDriver] "connectHardwareKeyboard": true
[debug] [BaseDriver] }
[info] [BaseDriver] Session created with session id: ba3f0114-0bfa-4e5a-8bb8-ee1d30e62166[debug] [XCUITest] Current user: 'testuser'
[info] [HTTP] [37m-->[39m [37mGET[39m [37m/wd/hub/sessions[39m
[info] [HTTP] {}
[debug] [GENERIC] Calling AppiumDriver.getSessions() with args: []
[debug] [GENERIC] Responding to client with driver.getSessions() result: []
[info] [HTTP] <-- GET /wd/hub/sessions 200 5 ms - 40
[info] [HTTP]
[info] [XCUITest] iOS SDK Version set to '13.2'[info] [iOSSim] Constructing iOS simulator for Xcode version 11.2.1 with udid 'C360E349-1255-4D96-B146-13D1FD3ACDF5'
[info] [XCUITest] Determining device to run tests on: udid: 'C360E349-1255-4D96-B146-13D1FD3ACDF5', real device: false
[debug] [BaseDriver] Event 'xcodeDetailsRetrieved' logged at 1574244119170 (10:01:59 GMT+0000 (GMT))
[info] [BaseDriver] Using local app '/Users/testuser/Desktop/IntegrationApp.app'
[debug] [BaseDriver] Event 'appConfigured' logged at 1574244119174 (10:01:59 GMT+0000 (GMT))
[debug] [XCUITest] Checking whether app '/Users/testuser/Desktop/IntegrationApp.app' is actually present on file system
[debug] [XCUITest] App is present
[debug] [iOS] Getting bundle ID from app '/Users/testuser/Desktop/IntegrationApp.app': 'com.demo2019.IntegrationApp'
[debug] [BaseDriver] Event 'resetStarted' logged at 1574244119179 (10:01:59 GMT+0000 (GMT))[info] [XCUITest] Not scrubbing third party app in anticipation of uninstall
[debug] [BaseDriver] Event 'resetComplete' logged at 1574244119388 (10:01:59 GMT+0000 (GMT))[warn] [XCUITest] Continuing without capturing device logs: iOS Simulator with udid C360E349-1255-4D96-B146-13D1FD3ACDF5 is not running
[info] [XCUITest] Setting up simulator
[debug] [iOS] No reason to set locale
[debug] [iOS] No iOS / app preferences to set
[debug] [iOS] Setting did not need to be updated
[debug] [iOSSim] Setting preferences of C360E349-1255-4D96-B146-13D1FD3ACDF5 Simulator to {"ConnectHardwareKeyboard":true}
[debug] [iOSSim] Setting common Simulator preferences to {"RotateWindowWhenSignaledByGuest":true,"ConnectHardwareKeyboard":true}
[debug] [iOSSim] Updated C360E349-1255-4D96-B146-13D1FD3ACDF5 Simulator preferences at '/Users/testuser/Library/Preferences/com.apple.iphonesimulator.plist' with {"DevicePreferences":{"C360E349-1255-4D96-B146-13D1FD3ACDF5":{"ConnectHardwareKeyboard":true}},"RotateWindowWhenSignaledByGuest":true,"ConnectHardwareKeyboard":true}[info] [iOSSim] Booting Simulator with UDID C360E349-1255-4D96-B146-13D1FD3ACDF5...[info] [iOSSim] Starting Simulator UI with command: open -Fn /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app --args -CurrentDeviceUDID C360E349-1255-4D96-B146-13D1FD3ACDF5 -ConnectHardwareKeyboard 1[info] [iOSSim] Simulator with UDID C360E349-1255-4D96-B146-13D1FD3ACDF5 booted in 16 seconds
[debug] [IDB] Connecting idb service to 'C360E349-1255-4D96-B146-13D1FD3ACDF5'
[debug] [IDB] Disconnecting idb service from 'C360E349-1255-4D96-B146-13D1FD3ACDF5'```
This issue is with idb. It seems that idb is not working properly. You need to uninstall idb completely.
pip uninstall fb-idb
brew uninstall idb
brew uninstall idb-companion
And then make sure that below commands should not give any results.
which idb
which idb-companion
Now run your code it should work fine.
Basically we don't need idb to run ios simulator
I Have observed that when I first time run my script that will run very fast without any delay response. However, immediately, if I run the same script without any changes or closing simulator or any kind of reset, following POST request takes more than 5 min to get a response.
Request from Appium:
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {"desiredCapabilities":{"bundleId":"XXX.XXXX.ios","arguments":[],"environment":{},"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true}}
Response:
[debug] [JSONWP Proxy] Got response with status 200: {"value":{"sessionId":"91784C9C-3B63-40D3-9335-9C80548E7E68","capabilities":{"device":"iphone","browserName":null,"sdkVersion":"11.4","CFBundleIdentifier":null}},"sessionId":"91784C9C-3B63-40D3-9335-9C80548E7E68","status":0}
Following are my configured version
Xcode Version: Xcode 9.4.1, Build version 9F2000
Appium: v1.8.1 also
tried with v1.9.1
node: 5.6.0
Javac: javac 1.8.0_171
Device: Simulator (iPhone 7)
Appium Java-client: 6.1.0
Full Appium log:
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"app":"/Users/user.name/Desktop/XXXXX.app","noReset":false,"unhandledPromptBehavior":true,"deviceName":"iPhone 7","version":"","platform":"MAC","newCommandTimeout":1500,"platformVersion":"11.4","automationName":"XCUITest","browserName":"iPhone","platformName":"IOS","udid":"7B7A3A94-372F-4872-8BD0-F7BC50CA2924","autoAcceptAlerts":true,"unexpectedAlertBehaviour":true},"capabilities":{"alwaysMatch":{"appium:app":"/Users/user.name/Desktop/XXXXX.app","appium:autoAcceptAlerts":true,"appium:automationName":"XCUITest","browserName":"iPhone","appium:deviceName":"iPhone 7","appium:newCommandTimeout":1500,"appium:noReset":false,"platform":"MAC","platformName":"ios","appium:platformVersion":"11.4","appium:udid":"7B7A3A94-372F-4872-8BD0-F7BC50CA2924","unexpectedAlertBehaviour":true,"unhandledPromptBehavior":true,"version":""},"firstMatch":[{}]}}
[debug] [W3C] Calling AppiumDriver.createSession() with args: [{"app":"/Users/user.name/Desktop/XXXXX.app","noReset":false,"unhandledPromptBehavior":true,"deviceName":"iPhone 7","version":"","platform":"MAC","newCommandTimeout":1500,"platformVersion":"11.4","automationName":"XCUITest","browserName":"iPhone","platformName":"IOS","udid":"7B7A3A94-372F-4872-8BD0-F7BC50CA2924","autoAcceptAlerts":true,"unexpectedAlertBehaviour":true},null,{"alwaysMatch":{"appium:app":"/Users/user.name/Desktop/XXXXX.app","appium:autoAcceptAlerts":true,"appium:automationName":"XCUITest","browserName":"iPhone","appium:deviceName":"iPhone 7","appium:newCommandTimeout":1500,"appium:noReset":false,"platform":"MAC","platformName":"ios","appium:platformVersion":"11.4","appium:udid":"7B7A3A94-372F-4872-8BD0-F7BC50CA2924","unexpectedAlertBehaviour":true,"unhandledPromptBehavior":true,"version":""},"firstMatch":[{}]}]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1539403642546 (09:37:22 GMT+0530 (IST))
[BaseDriver] The capabilities ["platform","unexpectedAlertBehaviour","version"] are not standard capabilities and should have an extension prefix
[Appium] Creating new XCUITestDriver (v2.84.0) session
[Appium] Capabilities:
[Appium] browserName: iPhone
[Appium] platform: MAC
[Appium] platformName: ios
[Appium] unexpectedAlertBehaviour: true
[Appium] unhandledPromptBehavior: true
[Appium] version:
[Appium] app: /Users/user.name/Desktop/XXXXX.app
[Appium] autoAcceptAlerts: true
[Appium] automationName: XCUITest
[Appium] deviceName: iPhone 7
[Appium] newCommandTimeout: 1500
[Appium] noReset: false
[Appium] platformVersion: 11.4
[Appium] udid: 7B7A3A94-372F-4872-8BD0-F7BC50CA2924
[debug] [BaseDriver] W3C capabilities {"alwaysMatch":{"browserNam... and MJSONWP desired capabilities [object Object] were provided
[debug] [BaseDriver] Creating session with W3C capabilities: {"alwaysMatch":{"browserNam...
[BaseDriver] The following capabilities were provided, but are not recognized by appium: unhandledPromptBehavior, platform, unexpectedAlertBehaviour, version.
[XCUITest] The capabilities 'autoAcceptAlerts' and 'autoDismissAlerts' do not work for XCUITest-based tests. Please adjust your alert handling accordingly.
[BaseDriver] Session created with session id: 7b782b91-6f85-433d-b713-070a891c95f9
[debug] [XCUITest] Current user: 'user.name'
[debug] [XCUITest] Xcode version set to '9.4.1' (tools v9.4.0.0.1.1526532315)
[debug] [XCUITest] iOS SDK Version set to '11.4'
[debug] [BaseDriver] Event 'xcodeDetailsRetrieved' logged at 1539403642636 (09:37:22 GMT+0530 (IST))
[iOSSim] Constructing iOS simulator for Xcode version 9.4.1 with udid '7B7A3A94-372F-4872-8BD0-F7BC50CA2924'
[XCUITest] Determining device to run tests on: udid: '7B7A3A94-372F-4872-8BD0-F7BC50CA2924', real device: false
[BaseDriver] Using local app '/Users/user.name/Desktop/XXXXX.app'
[debug] [BaseDriver] Event 'appConfigured' logged at 1539403642857 (09:37:22 GMT+0530 (IST))
[debug] [XCUITest] Checking whether app '/Users/user.name/Desktop/XXXXX.app' is actually present on file system
[debug] [XCUITest] App is present
[debug] [iOS] Getting bundle ID from app '/Users/user.name/Desktop/XXXXX.app': 'XXX.XXXX.ios'
[debug] [BaseDriver] Event 'resetStarted' logged at 1539403642858 (09:37:22 GMT+0530 (IST))
[XCUITest] Not scrubbing third party app in anticipation of uninstall
[debug] [BaseDriver] Event 'resetComplete' logged at 1539403643079 (09:37:23 GMT+0530 (IST))
[debug] [XCUITest] Starting log capture for iOS Simulator with udid '7B7A3A94-372F-4872-8BD0-F7BC50CA2924', using 'xcrun simctl spawn 7B7A3A94-372F-4872-8BD0-F7BC50CA2924 log stream --style compact'
[debug] [BaseDriver] Event 'logCaptureStarted' logged at 1539403643385 (09:37:23 GMT+0530 (IST))
[XCUITest] Setting up simulator
[debug] [iOS] No reason to set locale
[debug] [iOS] No iOS / app preferences to set
[debug] [iOSSim] Matched 1 Simulator cache item for cleanup: /Users/user.name/Library/Developer/CoreSimulator/Devices/7B7A3A94-372F-4872-8BD0-F7BC50CA2924/data/Library/Caches/com.apple.mobile.installd.staging
[debug] [iOSSim] Setting preferences of 7B7A3A94-372F-4872-8BD0-F7BC50CA2924 Simulator to {"ConnectHardwareKeyboard":false}
[debug] [iOSSim] Setting common Simulator preferences to {"ConnectHardwareKeyboard":false}
[debug] [iOSSim] Updated 7B7A3A94-372F-4872-8BD0-F7BC50CA2924 Simulator preferences at '/Users/user.name/Library/Preferences/com.apple.iphonesimulator.plist' with {"DevicePreferences":{"7B7A3A94-372F-4872-8BD0-F7BC50CA2924":{"ConnectHardwareKeyboard":false}},"ConnectHardwareKeyboard":false}
[debug] [iOSSim] The count of running Simulator UI client instances is 1
[iOSSim] Both Simulator with UDID 7B7A3A94-372F-4872-8BD0-F7BC50CA2924 and the UI client are currently running
[debug] [BaseDriver] Event 'simStarted' logged at 1539403643658 (09:37:23 GMT+0530 (IST))
[debug] [XCUITest] Verifying application platform
[debug] [XCUITest] CFBundleSupportedPlatforms: ["iPhoneSimulator"]
[debug] [XCUITest] Reset requested. Removing app with id 'XXX.XXXX.ios' from the device
[debug] [XCUITest] Installing '/Users/user.name/Desktop/XXXXX.app' on Simulator with UUID '7B7A3A94-372F-4872-8BD0-F7BC50CA2924'...
[debug] [XCUITest] The app has been installed successfully.
[debug] [BaseDriver] Event 'appInstalled' logged at 1539403647212 (09:37:27 GMT+0530 (IST))
[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] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Got response with status 200: "{\n \"value\" : {\n \"state\" : \"success\",\n \"os\" : {\n \"name\" : \"iOS\",\n \"version\" : \"11.4\",\n \"sdkVersion\" : \"11.3\"\n },\n \"ios\" : {\n \"simulatorVersion\" : \"11.4\",\n \"ip\" : \"192.168.2.4\"\n },\n \"build\" : {\n \"upgradedAt\" : \"1539327134564\",\n \"time\" : \"Oct 12 2018 12:22:23\",\n \"productBundleIdentifier\" : \"com.facebook.WebDriverAgentRunner\"\n }\n },\n \"sessionId\" : \"163984B3-334E-4054-AB68-99D93F26F976\",\n \"status\" : 0\n}"
[XCUITest] Will reuse previously cached WDA instance at 'http://localhost:8100/'. Set the wdaLocalPort capability to a value different from 8100 if this is an undesired behavior.
[debug] [BaseDriver] Event 'wdaStartAttempted' logged at 1539403647303 (09:37:27 GMT+0530 (IST))
[XCUITest] Using provided WebdriverAgent at 'http://localhost:8100/'
[debug] [BaseDriver] Event 'wdaSessionAttempted' logged at 1539403647304 (09:37:27 GMT+0530 (IST))
[debug] [XCUITest] Sending createSession command to WDA
[debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8100/status] with no body
[debug] [JSONWP Proxy] Got response with status 200: "{\n \"value\" : {\n \"state\" : \"success\",\n \"os\" : {\n \"name\" : \"iOS\",\n \"version\" : \"11.4\",\n \"sdkVersion\" : \"11.3\"\n },\n \"ios\" : {\n \"simulatorVersion\" : \"11.4\",\n \"ip\" : \"192.168.2.4\"\n },\n \"build\" : {\n \"upgradedAt\" : \"1539327134564\",\n \"time\" : \"Oct 12 2018 12:22:23\",\n \"productBundleIdentifier\" : \"com.facebook.WebDriverAgentRunner\"\n }\n },\n \"sessionId\" : \"163984B3-334E-4054-AB68-99D93F26F976\",\n \"status\" : 0\n}"
**[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {"desiredCapabilities":{"bundleId":"XXX.XXXX.ios","arguments":[],"environment":{},"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true}}**
[debug] [JSONWP Proxy] Got response with status 200: {"value":{"sessionId":"91784C9C-3B63-40D3-9335-9C80548E7E68","capabilities":{"device":"iphone","browserName":null,"sdkVersion":"11.4","CFBundleIdentifier":null}},"sessionId":"91784C9C-3B63-40D3-9335-9C80548E7E68","status":0}
[debug] [BaseDriver] Event 'wdaSessionStarted' logged at 1539403968659 (09:42:48 GMT+0530 (IST))
[debug] [BaseDriver] Event 'wdaStarted' logged at 1539403968659 (09:42:48 GMT+0530 (IST))
[XCUITest] Skipping setting of the initial display orientation. Set the "orientation" capability to either "LANDSCAPE" or "PORTRAIT", if this is an undesired behavior.
[debug] [BaseDriver] Event 'orientationSet' logged at 1539403968660 (09:42:48 GMT+0530 (IST))
[Appium] New XCUITestDriver session created successfully, session 7b782b91-6f85-433d-b713-070a891c95f9 added to master session list
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1539403968660 (09:42:48 GMT+0530 (IST))
[debug] [W3C] Responding to client with driver.createSession() result: {"capabilities":{"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"iPhone","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"networkConnectionEnabled":false,"platformName":"ios","unhandledPromptBehavior":true,"unexpectedAlertBehaviour":true,"version":"","app":"/Users/user.name/Desktop/XXXXX.app","autoAcceptAlerts":true,"automationName":"XCUITest","deviceName":"iPhone 7","newCommandTimeout":1500,"noReset":false,"platformVersion":"11.4","udid":"7B7A3A94-372F-4872-8BD0-F7BC50CA2924"}}
Try to run your tests with capability noReset: true and don't close/start driver before each test: you can use driver.launchApp() simply to restart it.
To start with I got a .ipa file from the development team to test, the developer has mentioned the .ipa file with the device UDID so that I can install it on my iPhone.
[Appium] Welcome to Appium v1.6.0
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> POST /wd/hub/session {"capabilities":{"desiredCapabilities":{"app":"/Users/apple/Downloads/ReaderManager.ipa","noReset":true,"platformVersion":"10.0","bundleId":"com.hidglobal.pacs.se.readermanager","platformName":"iOS","udid":"1f51471daf2a4674f11ece1a19d6cb4fa5569c02","deviceName":"iPhone 6"},"requiredCapabilities":{}},"desiredCapabilities":{"app":"/Users/apple/Downloads/ReaderManager.ipa","noReset":true,"platformVersion":"10.0","bundleId":"com.hidglobal.pacs.se.readermanager","platformName":"iOS","udid":"1f51471daf2a4674f11ece1a19d6cb4fa5569c02","deviceName":"iPhone 6"},"requiredCapabilities":{}}
[debug] [MJSONWP] Bad parameters: BadParametersError: Parameters were incorrect. We wanted {"required":["desiredCapabilities"],"optional":["requiredCapabilities","sessionId","id"]} and you sent ["capabilities","desiredCapabilities","requiredCapabilities"]
[HTTP] <-- POST /wd/hub/session 400 6 ms - 201
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"app":"/Users/apple/Downloads/ReaderManager.ipa","noReset":true,"platformVersion":"10.0","bundleId":"com.hidglobal.pacs.se.readermanager","platformName":"iOS","udid":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","deviceName":"iPhone 6"},"requiredCapabilities":{}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"/Users/apple/Downl...
[Appium] Requested iOS support with version >= 10, using XCUITest driver instead of UIAutomation-based driver, since the latter is unsupported on iOS 10 and up.
[Appium] Creating new XCUITestDriver session
[Appium] Capabilities:
[Appium] app: '/Users/apple/Downloads/xyz.ipa'
[Appium] noReset: true
[Appium] platformVersion: '10.0'
[Appium] bundleId: 'xxxxxxxx'(Changed Manually)
[Appium] platformName: 'iOS'
[Appium] udid: 'xxxxxxxxxxxxxxxxxxxxx'(Changed Manually)
[Appium] deviceName: 'iPhone 6'
[debug] [XCUITest] XCUITestDriver version: 2.0.26
[BaseDriver] Session created with session id: f1a2a222-8e4f-47fb-bbbd-2429f159b403
[debug] [XCUITest] Xcode version set to '8.0'
[debug] [XCUITest] iOS SDK Version set to '10.0'
[debug] [XCUITest] Available devices: xxxxxxxxxxxxxx
[debug] [XCUITest] Creating iDevice object with udid xxxxxxxxxxxxxxxxxxx
[XCUITest] Determining device to run tests on: udid: 'xxxxxxxxxxxxxxxxx', real device: true
[BaseDriver] Using local app '/Users/apple/Downloads/ReaderManager.ipa'
[debug] [BaseDriver] Copying local zip to tmp dir
[debug] [BaseDriver] Unzipping /var/folders/2d/qg1847_14nd90zgq9_m30zhc0000gn/T/2016926-3576-bfkmhz.8l1yycik9/appium-app.zip
[debug] [BaseDriver] Testing zip archive: /var/folders/2d/qg1847_14nd90zgq9_m30zhc0000gn/T/2016926-3576-bfkmhz.8l1yycik9/appium-app.zip
[BaseDriver] Unzipped local app to '/var/folders/2d/qg1847_14nd90zgq9_m30zhc0000gn/T/2016926-3576-bfkmhz.8l1yycik9/Payload/ReaderManager.app'
[debug] [XCUITest] Checking whether app is actually present
[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] Stdout from app isInstalled check: [....] Waiting for iOS device to be connected
[....] Using iPhone 6 (GSM) 'Iphone 6' (xxxxxxxxxxxxxxx).
true
[debug] [XCUITest] App is installed.
[debug] [XCUITest] Full reset not requested. No need to install.
[XCUITest] Using default agent: /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj
[XCUITest] Using default bootstrap: /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
[XCUITest] Launching WebDriverAgent on the device
[debug] [XCUITest] Carthage found: /usr/local/bin/carthage
[debug] [XCUITest] Beginning test with command '/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/bin/run-xcodebuild.sh --project /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj --scheme WebDriverAgentRunner --destination id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' in directory '/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent'
[XCUITest] Waiting for WebDriverAgent to start on device
[XCUITest] The real device logger 'idevicesyslog' was unable to start log capture. Please try installing 'deviceconsole' ('npm install -g deviceconsole') and specify the path to it using the 'realDeviceLogger' capability.
[debug] [XCUITest] Log file for xcodebuild test: /Users/apple/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/5D3AF14D-B012-422A-B281-1F3CE59A49EA/Session-WebDriverAgentRunner-2016-10-26_150854-8VLGgF.log
[Xcode] 2016-10-26 15:08:58.437 xcodebuild[3594:21573] Error Domain=IDETestOperationsObserverErrorDomain Code=3 "Test operation was canceled. If you believe this error represents a bug, please attach the log file at /Users/apple/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/5D3AF14D-B012-422A-B281-1F3CE59A49EA/Session-WebDriverAgentRunner-2016-10-26_150854-8VLGgF.log" UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /Users/apple/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Logs/Test/5D3AF14D-B012-422A-B281-1F3CE59A49EA/Session-WebDriverAgentRunner-2016-10-26_150854-8VLGgF.log}
[Xcode] Code signing is required for product type 'UI Testing Bundle' in SDK 'iOS 10.0'
[Xcode] Signing for "WebDriverAgentRunner" requires a development team. Select a development team in the project editor.enter code here
[Xcode] Code signing is required for product type 'UI Testing Bundle' in SDK 'iOS 10.0'
During my execution of script I am getting the above issue.
Request the team to help me in identifying the issue and how to resolve it.
Thanks,
Goutham
Run the below command in terminal to open WebDriverAgent project.
Open usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj
Now this will open the WebDriverAgent project in xcode.
Go to build settings of the project as shown in below screenshot and add the development team.
If no options are available in development team to select then follow the below procedure to add the account.
a. Click on xcode and navigate to preferences.
b. Click on Accounts.
c. Click on ‘+’ symbol and add the account same as the account used for the code signing activity.
Now you can select the added account in Development Team.
The account selected for the development team should be same as the account selected for code signing activity.
Now add development team for all the targets also similarly by navigating to build settings.
Run the code to check for any errors and build succeeded message should be displayed.
Please refer Bluedev comment as well.
if you are unable to execute appium script even after creating a developer team and building the app in Xcode..
Follow the steps given in the below link and try running appium after those steps, I tried it (note: there were some unthinkable libraries missing installation:) and working for me. I am having Mac OS 10.12.5 and Appium version 1.6.5. Hope this is helpful.
Appium Setup for running on real and emulated devices
I am using appium version 1.3.7.
I have connected physical device via usb.
I have launched appium server,after a while appium get crashed.
I have pasted that full log below.
I have attached the screen shot below.
Launching Appium with command: '/Applications/Appium.app/Contents/Resources/node/bin/node' lib/server/main.js --command-timeout "7200" --pre-launch --platform-version "8.1" --platform-name "iOS" --app "/Users/al/work/sample.app" --udid "f5de3fd5ccded92e40e86c652ce2a6f9414fe1a0" --device-name "iPhone 4s"
info: [debug] Starting Appium in pre-launch mode
info: Pre-launching app
info: [debug] Using local app from command line: /Users//al/work/sample.app
info: [debug] Creating new appium session 1cdc5dc0-36d2-40b9-922b-33601f28846b
info: [debug] Removing any remaining instruments sockets
info: [debug] Cleaned up instruments socket /tmp/instruments_sock
info: [debug] Setting Xcode folder
info: [debug] Setting Xcode version
info: [debug] Setting iOS SDK Version
info: [debug] Getting sdk version from xcrun with a timeout
info: [debug] iOS SDK Version set to 8.1
info: [debug] Not checking whether simulator is available since we're on a real device
info: [debug] Detecting automation tracetemplate
info: [debug] Not auto-detecting udid, running on sim
info: [debug] Parsed app Info.plist (as binary)
info: [debug] Parsed app Localizable.strings
info: [debug] Getting bundle ID from app
info: [debug] Parsed app Info.plist (as binary)
info: [debug] Creating instruments
info: On some xcode 6 platforms, instruments-without-delay does not work. If you experience this, you will need to re-run appium with the --native-instruments-lib flag
info: [debug] Preparing uiauto bootstrap
info: [debug] Dynamic bootstrap dir: /Users/alk/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":"grouped"}
info: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!
...
info: [debug] Dynamic bootstrap path: /Users/alk/Library/Application Support/appium/bootstrap/bootstrap-d5a0fb924946d8d3.js
info: [debug] Reusing dynamic bootstrap: /Users/alk/Library/Application Support/appium/bootstrap/bootstrap-d5a0fb924946d8d3.js
info: [debug] Getting device string from opts: {"forceIphone":false,"forceIpad":false,"xcodeVersion":"6.1.1","iOSSDKVersion":"8.1","deviceName":"iPhone 4s","platformVersion":"8.1"}
info: [debug] fixDevice is on
info: [debug] Final device string is: 'iPhone 4s (8.1 Simulator)'
info: [debug] Not setting device type since we're on a real device
info: [debug] Checking whether we need to set app preferences
info: [debug] Not setting iOS and app preferences since we're on a real device
info: [debug] Running ios sim reset flow
info: [debug] Killing the simulator process
info: [debug] Killall iOS Simulator
info: [debug] Killing any other simulator daemons
info: [debug] On a real device; cannot clean device state
info: [debug] Not setting locale because we're using a real device
info: [debug] No iOS / app preferences to set
info: [debug] Starting iOS device log capture via deviceconsole
info: [debug] Not pre-launching simulator
info: [debug] Creating iDevice object with udid f5de3fd5ccded92e40e86c652ce2a6f9414ee1a2
info: [debug] Checking app install status using: /Applications/Appium.app/Contents/Resources/node_modules/appium/build/fruitstrap/fruitstrap isInstalled --id f5de3fd5ccded92e40e86c652ce2a6f9414ee1a2 --bundle com.vr.iphone.sample
info: [debug] App is not installed. Will try to install the app.
info: [debug] Installing app using cmd: /Applications/Appium.app/Contents/Resources/node_modules/appium/build/fruitstrap/fruitstrap install --id f5de3fd5ccded92e40e86c652ce2a6f9414ee1a2 --bundle "/Users/al/work/sample.app
info: [debug] Cleaning up appium session
error: Could not pre-launch appium: Error: Unable to install [/Users/al/work/sample.app] to device with id [f5de3fd5ccded92e40e86c652ce2a6f9414ee1a2]. Error [Error: Command failed: /bin/sh -c /Applications/Appium.app/Contents/Resources/node_modules/appium/build/fruitstrap/fruitstrap install --id f5de3fd5ccded92e40e86c652ce2a6f9414ee1a2 --bundle "/Users/al/work/sample.app"
Assertion failed: (AMDeviceStartService(device, CFSTR("com.apple.afc"), &afcFd, NULL) == 0), function handle_device, file fruitstrap.c, line 523.
]
You can use Appium to install your app on your device, Just uninstall your App manually and in setUp code use absolute path of .apk file like this:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("VERSION", "5.1.1");
capabilities.setCapability("deviceName", "Name");
File appDir = new File("/home/filename/ProjectFile");
File app = new File(appDir, "appname.apk");
capabilities.setCapability("app",app.getAbsolutePath());
It will install your app on your device.
You said you tried to launch on real device, but your logs saying you tried to launch on simulator.
If you are using UI version of appium, Please uncheck Force Device option in appium and give UDID of real device which you connected in appium and prelaunch. your app will be installed.
I have installed appium version 1.3.6.
I have launched appium server to inspect an ios app.
I have furnished the error below.
Launching Appium with command: '/Applications/Appium.app/Contents/Resources/node/bin/node'; lib/server/main.js --command-timeout "7200" --pre-launch --log "/tmp/appium.log" --platform-version "8.1" --platform-name "iOS" --app "com.iphonewidget.iphone.testapp" --show-ios-log --device-name "iPhone 6"
info: [debug] Starting Appium in pre-launch mode
info: Pre-launching app
info: [debug] App is an iOS bundle, will attempt to run as pre-existing
info: [debug] Creating new appium session 255637cf-2d12-41c3-8610-e53f804d229b
info: [debug] Removing any remaining instruments sockets
info: [debug] Cleaned up instruments socket /tmp/instruments_sock
info: [debug] Setting Xcode folder
info: [debug] Setting Xcode version
info: [debug] Setting iOS SDK Version
info: [debug] Getting sdk version from xcrun with a timeout
info: [debug] iOS SDK Version set to 8.1
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":"6.1.1","iOSSDKVersion":"8.1","deviceName":"iPhone 6","platformVersion":"8.1"}
info: [debug] fixDevice is on
info: [debug] Final device string is: 'iPhone 6 (8.1 Simulator)'
info: [debug] iOS sim UDID is 4391D23F-BA21-4FB8-8887-0972D2911420
info: [debug] Detecting automation tracetemplate
info: [debug] Not auto-detecting udid, running on sim
info: [debug] Could not parse plist file (as binary) at /Applications/Appium.app/Contents/Resources/node_modules/appium/com.iphonewidget.iphone.testapp/en.lproj/Localizable.strings
info: Will try to parse the plist file as XML
info: [debug] Could not parse plist file (as XML) at /Applications/Appium.app/Contents/Resources/node_modules/appium/com.iphonewidget.iphone.testapp/en.lproj/Localizable.strings
warn: Could not parse app Localizable.strings assuming it doesn´t exist
info: [debug] Creating instruments
info: On some xcode 6 platforms, instruments-without-delay does not work. If you experience this, you will need to re-run appium with the --native-instruments-lib flag
info: [debug] Preparing uiauto bootstrap
info: [debug] Dynamic bootstrap dir: /Users/alk/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!
...
error: Could not set the device type in Info.plist
Unchecking "Prelaunch Application" under General Settings resolved this issue for me.