0

In iPhone simulator i can't run Test cases when Appium server i started from terminal.

It shows Error: unable to launch webdriveragent because of xcodebuild failure: xcodebuild failed with code 65.

But, If I'm run the server from Appium Server GUI, My test case getting passed in simulator.

VERSIONS:

  • Node.js = v20.3.1
  • NPM = 9.7.2
  • Appium = 1.22.3
  • XCode = 14.2

CAPABILITES:

var appiumOPtions = new AppiumOptions();
 
            appiumOPtions.AddAdditionalCapability(MobileCapabilityType.DeviceName, "iPhone 14 Pro Max");
            appiumOPtions.AddAdditionalCapability(MobileCapabilityType.PlatformName, "ios");
            appiumOPtions.AddAdditionalCapability(MobileCapabilityType.PlatformVersion, "16.2");
            appiumOPtions.AddAdditionalCapability(MobileCapabilityType.AutomationName, "XCUITest");
            //appiumOPtions.AddAdditionalCapability("appium:automationName",AutomationName.iOSXcuiTest);
            appiumOPtions.AddAdditionalCapability(MobileCapabilityType.NoReset, "true");
            appiumOPtions.AddAdditionalCapability(MobileCapabilityType.NewCommandTimeout, "60");
            appiumOPtions.AddAdditionalCapability("wdaStartupRetries", "4");
            appiumOPtions.AddAdditionalCapability("iosInstallPause", "8000");
            appiumOPtions.AddAdditionalCapability("wdaStartupRetryInterval", "20000");
            appiumOPtions.AddAdditionalCapability("app", @"/Users/mark/Perforce/build.manager_macbuild_edgemobile/Solutions/Clients/EdgeMobile/EdgeMobile.iOS/bin/iPhoneSimulator/Debug/EdgeMobile.iOS.app");
            Thread.Sleep(5000);
            driver = new IOSDriver<IOSElement>(new Uri("http://127.0.0.1:4723/wd/hub"), appiumOPtions);

**TERMINAL **OUTPUT:

macbuild:~ mark$ appium
[Appium] Welcome to Appium v1.22.3
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[debug] [HTTP] Request idempotency key: 8580a9e1-7303-497d-bd45-ebb1918530bc
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"deviceName":"iPhone 14 Pro Max","platformName":"iOS","platformVersion":"16.2","automationName":"XCUITest","noReset":"true","newCommandTimeout":"60","wdaStartupRetries":"4","iosInstallPause":"8000","wdaStartupRetryInterval":"20000","app":"/Users/mark/Perforce/build.manager_macbuild_edgemobile/Solutions/Clients/EdgeMobile/EdgeMobile.iOS/bin/iPhoneSimulator/Debug/EdgeMobile.iOS.app"},"capabilities":{"firstMatch":[{"platformName":"iOS"}]}}
[debug] [W3C] Calling AppiumDriver.createSession() with args: [{"deviceName":"iPhone 14 Pro Max","platformName":"iOS","platformVersion":"16.2","automationName":"XCUITest","noReset":"true","newCommandTimeout":"60","wdaStartupRetries":"4","iosInstallPause":"8000","wdaStartupRetryInterval":"20000","app":"/Users/mark/Perforce/build.manager_macbuild_edgemobile/Solutions/Clients/EdgeMobile/EdgeMobile.iOS/bin/iPhoneSimulator/Debug/EdgeMobile.iOS.app"},null,{"firstMatch":[{"platformName":"iOS"}]}]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1687943749757 (02:15:49 GMT-0700 (Pacific Daylight Time))
[Appium] The following capabilities were provided in the JSONWP desired capabilities that are missing in W3C capabilities: ["deviceName","platformVersion","automationName","noReset","newCommandTimeout","wdaStartupRetries","iosInstallPause","wdaStartupRetryInterval","app"]
[Appium] Trying to fix W3C capabilities by merging them with JSONWP caps
[BaseDriver] The following capabilities are not standard capabilities and should have an extension prefix:
[BaseDriver]   deviceName
[BaseDriver]   platformVersion
[BaseDriver]   automationName
[BaseDriver]   noReset
[BaseDriver]   newCommandTimeout
[BaseDriver]   wdaStartupRetries
[BaseDriver]   iosInstallPause
[BaseDriver]   wdaStartupRetryInterval
[BaseDriver]   app
[BaseDriver] Number capability passed in as string. Functionality may be compromised.
[Appium] Appium v1.22.3 creating new XCUITestDriver (v3.59.0) session
[debug] [BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided
[debug] [BaseDriver] Creating session with W3C capabilities: {
[debug] [BaseDriver]   "alwaysMatch": {
[debug] [BaseDriver]     "appium:deviceName": "iPhone 14 Pro Max",
[debug] [BaseDriver]     "appium:platformVersion": "16.2",
[debug] [BaseDriver]     "appium:automationName": "XCUITest",
[debug] [BaseDriver]     "appium:noReset": "true",
[debug] [BaseDriver]     "appium:newCommandTimeout": "60",
[debug] [BaseDriver]     "appium:wdaStartupRetries": "4",
[debug] [BaseDriver]     "appium:iosInstallPause": "8000",
[debug] [BaseDriver]     "appium:wdaStartupRetryInterval": "20000",
[debug] [BaseDriver]     "appium:app": "/Users/mark/Perforce/build.manager_macbuild_edgemobile/Solutions/Clients/EdgeMobile/EdgeMobile.iOS/bin/iPhoneSimulator/Debug/EdgeMobile.iOS.app",
[debug] [BaseDriver]     "platformName": "iOS"
[debug] [BaseDriver]   },
[debug] [BaseDriver]   "firstMatch": [
[debug] [BaseDriver]     {}
[debug] [BaseDriver]   ]
[debug] [BaseDriver] }
[BaseDriver] Number capability passed in as string. Functionality may be compromised.
[BaseDriver] Number capability passed in as string. Functionality may be compromised.
[BaseDriver] Number capability passed in as string. Functionality may be compromised.
[BaseDriver] Number capability passed in as string. Functionality may be compromised.
[BaseDriver] Capability 'noReset' changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Capability 'newCommandTimeout' changed from string ('60') to integer (60). This may cause unexpected behavior
[BaseDriver] Capability 'iosInstallPause' changed from string ('8000') to integer (8000). This may cause unexpected behavior
[BaseDriver] Capability 'wdaStartupRetries' changed from string ('4') to integer (4). This may cause unexpected behavior
[BaseDriver] Capability 'wdaStartupRetryInterval' changed from string ('20000') to integer (20000). This may cause unexpected behavior
[BaseDriver] Session created with session id: 431b126a-38a5-4a83-b6a7-4c01f034589b
[debug] [XCUITest] Current user: 'mark'
[XCUITest] iOS SDK Version set to '16.2'
[iOSSim] Constructing iOS simulator for Xcode version 14.2 with udid '73AB5636-C7D9-4B22-9F6F-28C67D86B9BB'
[XCUITest] Determining device to run tests on: udid: '73AB5636-C7D9-4B22-9F6F-28C67D86B9BB', real device: false
[debug] [BaseDriver] Event 'xcodeDetailsRetrieved' logged at 1687943750398 (02:15:50 GMT-0700 (Pacific Daylight Time))
[BaseDriver] Using local app '/Users/mark/Perforce/build.manager_macbuild_edgemobile/Solutions/Clients/EdgeMobile/EdgeMobile.iOS/bin/iPhoneSimulator/Debug/EdgeMobile.iOS.app'
[debug] [BaseDriver] Event 'appConfigured' logged at 1687943750400 (02:15:50 GMT-0700 (Pacific Daylight Time))
[debug] [XCUITest] Checking whether app '/Users/mark/Perforce/build.manager_macbuild_edgemobile/Solutions/Clients/EdgeMobile/EdgeMobile.iOS/bin/iPhoneSimulator/Debug/EdgeMobile.iOS.app' is actually present on file system
[debug] [XCUITest] App is present
[debug] [XCUITest] Getting bundle ID from app '/Users/mark/Perforce/build.manager_macbuild_edgemobile/Solutions/Clients/EdgeMobile/EdgeMobile.iOS/bin/iPhoneSimulator/Debug/EdgeMobile.iOS.app': 'com.weatherford.edgemobile'
[debug] [BaseDriver] Event 'resetStarted' logged at 1687943750402 (02:15:50 GMT-0700 (Pacific Daylight Time))
[debug] [XCUITest] Reset: noReset is on. Leaving simulator as is
[debug] [BaseDriver] Event 'resetComplete' logged at 1687943750402 (02:15:50 GMT-0700 (Pacific Daylight Time))
[WebDriverAgent] Using WDA path: '/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent'
[WebDriverAgent] Using WDA agent: '/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj'
[debug] [IOSSimulatorLog] Starting log capture for iOS Simulator with udid '73AB5636-C7D9-4B22-9F6F-28C67D86B9BB' using simctl
[debug] [BaseDriver] Event 'logCaptureStarted' logged at 1687943750847 (02:15:50 GMT-0700 (Pacific Daylight Time))
[XCUITest] Setting up simulator
[debug] [XCUITest] No reason to set locale
[debug] [XCUITest] No iOS / app preferences to set
[debug] [XCUITest] Setting did not need to be updated
[debug] [iOSSim] Setting preferences of 73AB5636-C7D9-4B22-9F6F-28C67D86B9BB Simulator to {"ConnectHardwareKeyboard":false}
[debug] [iOSSim] Setting common Simulator preferences to {"RotateWindowWhenSignaledByGuest":true,"ConnectHardwareKeyboard":false,"PasteboardAutomaticSync":false}
[debug] [iOSSim] Updated 73AB5636-C7D9-4B22-9F6F-28C67D86B9BB Simulator preferences at '/Users/mark/Library/Preferences/com.apple.iphonesimulator.plist' with {"RotateWindowWhenSignaledByGuest":true,"ConnectHardwareKeyboard":false,"PasteboardAutomaticSync":false,"DevicePreferences":{"73AB5636-C7D9-4B22-9F6F-28C67D86B9BB":{"ConnectHardwareKeyboard":false,"SimulatorExternalDisplay":2114,"SimulatorWindowOrientation":"Portrait","SimulatorWindowGeometry":{"6479BBD2-CEC1-4C11-9D2E-16318D3ACA8A":{"WindowCenter":"{1090.5, 592.5}","WindowScale":0.7109053497942387}},"SimulatorWindowRotationAngle":0,"ChromeTint":""}}}
[debug] [iOSSim] Got Simulator UI client PID: 13449
[iOSSim] Both Simulator with UDID '73AB5636-C7D9-4B22-9F6F-28C67D86B9BB' and the UI client are currently running
[debug] [BaseDriver] Event 'simStarted' logged at 1687943751470 (02:15:51 GMT-0700 (Pacific Daylight Time))
[debug] [XCUITest] Verifying application platform
[debug] [XCUITest] CFBundleSupportedPlatforms: ["iPhoneSimulator"]
[debug] [XCUITest] App 'com.weatherford.edgemobile' is already installed. No need to reinstall.
[debug] [XCUITest] iosInstallPause set. Pausing 8000 ms before continuing
[debug] [WebDriverAgent] Parsed BUILD_DIR configuration value: '/Users/mark/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu/Build/Products'
[debug] [WebDriverAgent] Got derived data root: '/Users/mark/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu'
[debug] [BaseDriver] Event 'appInstalled' logged at 1687943759701 (02:15:59 GMT-0700 (Pacific Daylight Time))
[debug] [WebDriverAgent] No obsolete cached processes from previous WDA sessions listening on port 8100 have been found
[DevCon Factory] Requesting connection for device 73AB5636-C7D9-4B22-9F6F-28C67D86B9BB on local port 8100
[debug] [DevCon Factory] Cached connections count: 0
[DevCon Factory] Successfully requested the connection for 73AB5636-C7D9-4B22-9F6F-28C67D86B9BB:8100
[debug] [XCUITest] Starting WebDriverAgent initialization with the synchronization key 'XCUITestDriver'
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:8100
[debug] [WebDriverAgent] WDA is not listening at 'http://127.0.0.1:8100/' (http://127.0.0.1:8100/%27)
[debug] [WebDriverAgent] WDA is currently not running. There is nothing to cache
[debug] [XCUITest] Trying to start WebDriverAgent 4 times with 20000ms interval
[debug] [BaseDriver] Event 'wdaStartAttempted' logged at 1687943759794 (02:15:59 GMT-0700 (Pacific Daylight Time))
[WebDriverAgent] Launching WebDriverAgent on the device
[WebDriverAgent] WebDriverAgent does not need a cleanup. The sources are up to date (1687941403490 >= 1687941403490)
[debug] [WebDriverAgent] Killing running processes 'xcodebuild.*73AB5636-C7D9-4B22-9F6F-28C67D86B9BB, 73AB5636-C7D9-4B22-9F6F-28C67D86B9BB.*XCTRunner, xctest.*73AB5636-C7D9-4B22-9F6F-28C67D86B9BB' for the device 73AB5636-C7D9-4B22-9F6F-28C67D86B9BB...
[debug] [WebDriverAgent] 'pgrep -if xcodebuild.*73AB5636-C7D9-4B22-9F6F-28C67D86B9BB' didn't detect any matching processes. Return code: 1
[debug] [WebDriverAgent] 'pgrep -if 73AB5636-C7D9-4B22-9F6F-28C67D86B9BB.*XCTRunner' didn't detect any matching processes. Return code: 1
[debug] [WebDriverAgent] 'pgrep -if xctest.*73AB5636-C7D9-4B22-9F6F-28C67D86B9BB' didn't detect any matching processes. Return code: 1
[debug] [WebDriverAgent] Beginning test with command 'xcodebuild build-for-testing test-without-building -project /usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -derivedDataPath /Users/mark/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu -destination id=73AB5636-C7D9-4B22-9F6F-28C67D86B9BB IPHONEOS_DEPLOYMENT_TARGET=16.2 GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO' in directory '/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent'
[debug] [WebDriverAgent] Output from xcodebuild will only be logged if any errors are present there. To change this, use 'showXcodeLog' desired capability
[debug] [WebDriverAgent] Waiting up to 60000ms for WebDriverAgent to start
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:8100
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:8100
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:8100
[WebDriverAgent] xcodebuild exited with code '65' and signal 'null'
[WebDriverAgent] Launching WebDriverAgent on the device
[WebDriverAgent] WebDriverAgent does not need a cleanup. The sources are up to date (1687941403490 >= 1687941403490)
[debug] [WebDriverAgent] Killing running processes 'xcodebuild.*73AB5636-C7D9-4B22-9F6F-28C67D86B9BB, 73AB5636-C7D9-4B22-9F6F-28C67D86B9BB.*XCTRunner, xctest.*73AB5636-C7D9-4B22-9F6F-28C67D86B9BB' for the device 73AB5636-C7D9-4B22-9F6F-28C67D86B9BB...
[debug] [WebDriverAgent] 'pgrep -if 73AB5636-C7D9-4B22-9F6F-28C67D86B9BB.*XCTRunner' didn't detect any matching processes. Return code: 1
[debug] [WebDriverAgent] 'pgrep -if xcodebuild.*73AB5636-C7D9-4B22-9F6F-28C67D86B9BB' didn't detect any matching processes. Return code: 1
[debug] [WebDriverAgent] 'pgrep -if xctest.*73AB5636-C7D9-4B22-9F6F-28C67D86B9BB' didn't detect any matching processes. Return code: 1
[debug] [WebDriverAgent] Beginning test with command 'xcodebuild build-for-testing test-without-building -project /usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -derivedDataPath /Users/mark/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu -destination id=73AB5636-C7D9-4B22-9F6F-28C67D86B9BB IPHONEOS_DEPLOYMENT_TARGET=16.2 GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO' in directory '/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent'
[debug] [WebDriverAgent] Output from xcodebuild will only be logged if any errors are present there. To change this, use 'showXcodeLog' desired capability
[debug] [WebDriverAgent] Waiting up to 60000ms for WebDriverAgent to start
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:8100
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:8100
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:8100
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:8100
[WebDriverAgent] xcodebuild exited with code '65' and signal 'null'
[debug] [BaseDriver] Event 'wdaStartFailed' logged at 1687943768891 (02:16:08 GMT-0700 (Pacific Daylight Time))
[debug] [XCUITest] Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65
[debug] [XCUITest] xcodebuild error message:
[debug] [XCUITest] 
[XCUITest] Quitting and uninstalling WebDriverAgent
[WebDriverAgent] Shutting down sub-processes
[debug] [iOSSim] Building bundle path map
[debug] [iOSSim] The simulator has '0' bundles which have 'WebDriverAgentRunner-Runner' as their 'CFBundleName':
[debug] [WebDriverAgent] No WDAs on the device.
[debug] [BaseDriver] Event 'wdaStartAttempted' logged at 1687943789069 (02:16:29 GMT-0700 (Pacific Daylight Time))
[XCUITest] Retrying WDA startup (2 of 4)
[WebDriverAgent] Launching WebDriverAgent on the device
[WebDriverAgent] WebDriverAgent does not need a cleanup. The sources are up to date (1687941403490 >= 1687941403490)
[debug] [WebDriverAgent] Killing running processes 'xcodebuild.*73AB5636-C7D9-4B22-9F6F-28C67D86B9BB, 73AB5636-C7D9-4B22-9F6F-28C67D86B9BB.*XCTRunner, xctest.*73AB5636-C7D9-4B22-9F6F-28C67D86B9BB' for the device 73AB5636-C7D9-4B22-9F6F-28C67D86B9BB...
[debug] [WebDriverAgent] 'pgrep -if 73AB5636-C7D9-4B22-9F6F-28C67D86B9BB.*XCTRunner' didn't detect any matching processes. Return code: 1
[debug] [WebDriverAgent] 'pgrep -if xcodebuild.*73AB5636-C7D9-4B22-9F6F-28C67D86B9BB' didn't detect any matching processes. Return code: 1
[debug] [WebDriverAgent] 'pgrep -if xctest.*73AB5636-C7D9-4B22-9F6F-28C67D86B9BB' didn't detect any matching processes. Return code: 1
[debug] [WebDriverAgent] Beginning test with command 'xcodebuild build-for-testing test-without-building -project /usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -derivedDataPath /Users/mark/Library/Developer/Xcode/DerivedData/WebDriverAgent-ciegwgvxzxdrqthilmrmczmqvrgu -destination id=73AB5636-C7D9-4B22-9F6F-28C67D86B9BB IPHONEOS_DEPLOYMENT_TARGET=16.2 GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO' in directory '/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent'

I Tried below steps

  • Done all these steps in this link text

  • changed Appium server like npm install -g appium@latest,next,beta no use

No use of it.

Please any one tell me the solution for run the test case but run the appium server via terminal.

  • Can you make sure that the version you strart with from cli is indeed the one you spceify? You can see this by running the command `appium -v` in terminal – ChrisMersi Jun 29 '23 at 08:54
  • @ChrisMersi appium -v gives 1.22.3 – haris yadav Jun 29 '23 at 13:00
  • I would suggest comparing the server startups and seeing if there are any differences in versions. When you start a server, it specifies the server, and the driver versions, compare these values. If you don't find any differences perhaps upgrading your driver via terminal `appium driver update xcuitest` will fix your issue. Furthermore, when trying with appium v2, did you remove the `/wd/hub` from your path? if not I would try this as well. – ChrisMersi Jun 30 '23 at 06:33
  • Another thing you could try is, if the iOS simulators retain their state, uninstall the webdriver agent, and reboot it. – ChrisMersi Jun 30 '23 at 06:57

0 Answers0