Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65

Hi,

When i am trying to run my mobile app automation test on iOS device, I am getting error in appium log:

2022-04-12 12:40:14:687 - e[35m[WebDriverAgent]e[39m xcodebuild exited with code ‘65’ and signal ‘null’
2022-04-12 12:40:14:688 - [debug] e[35m[BaseDriver]e[39m Event ‘wdaStartFailed’ logged at 1649767214688 (15:40:14 GMT+0300 (Eastern European Summer Time))
2022-04-12 12:40:14:688 - [debug] e[35m[XCUITest]e[39m Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65
2022-04-12 12:40:14:688 - [debug] e[35m[XCUITest]e[39m xcodebuild error message:
2022-04-12 12:40:14:688 - [debug] e[35m[XCUITest]e[39m . Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
2022-04-12 12:40:14:688 - e[35m[XCUITest]e[39m Quitting and uninstalling WebDriverAgent
2022-04-12 12:40:14:688 - e[35m[WebDriverAgent]e[39m Shutting down sub-processes
2022-04-12 12:40:14:853 - [debug] e[35m[WebDriverAgent]e[39m No WDAs on the device.
2022-04-12 12:40:14:854 - e[35m[XCUITest]e[39m {}
2022-04-12 12:40:14:854 - e[35m[DevCon Factory]e[39m Releasing connections for 00008030-001E65E90ADB802E device on any port number
2022-04-12 12:40:14:854 - e[35m[DevCon Factory]e[39m Found cached connections to release: [“00008030-001E65E90ADB802E:5335”]
2022-04-12 12:40:14:854 - e[35m[DevCon Factory]e[39m Releasing the listener for ‘00008030-001E65E90ADB802E:5335’
2022-04-12 12:40:14:854 - [debug] e[35m[[email protected]:5335]e[39m Closing the connection
2022-04-12 12:40:14:855 - [debug] e[35m[DevCon Factory]e[39m Cached connections count: 0
2022-04-12 12:40:14:855 - [debug] e[35m[XCUITest]e[39m Not clearing log files. Use clearSystemFiles capability to turn on.
2022-04-12 12:40:14:855 - e[35m[[email protected]:5335]e[39m The connection has been closed
2022-04-12 12:40:14:856 - [debug] e[35m[BaseDriver]e[39m Event ‘newSessionStarted’ logged at 1649767214856 (15:40:14 GMT+0300 (Eastern European Summer Time))
2022-04-12 12:40:14:856 - [debug] e[35m[W3C]e[39m Encountered internal error running command: Error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65
2022-04-12 12:40:14:856 - [debug] e[35m[W3C]e[39m xcodebuild error message:
2022-04-12 12:40:14:856 - [debug] e[35m[W3C]e[39m . Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
2022-04-12 12:40:14:856 - [debug] e[35m[W3C]e[39m at quitAndUninstall (/opt/homebrew/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:585:15)
2022-04-12 12:40:14:856 - [debug] e[35m[W3C]e[39m at /opt/homebrew/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:620:11
2022-04-12 12:40:14:856 - [debug] e[35m[W3C]e[39m at wrapped (/opt/homebrew/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:60:13)
2022-04-12 12:40:14:856 - [debug] e[35m[W3C]e[39m at retry (/opt/homebrew/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:43:13)
2022-04-12 12:40:14:856 - [debug] e[35m[W3C]e[39m at retryInterval (/opt/homebrew/lib/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:70:10)
2022-04-12 12:40:14:858 - [debug] e[35m[W3C]e[39m at /opt/homebrew/lib/node_modules/appium/node_modules/appium-xcuitest-driver/lib/driver.js:600:7

Can any one please let me know what it means and the solution to overcome.

When I run xcode build successfully.

system used: Mac M1
Xcode version : 13.3
appium version: 1.22.3
iOS version: 15.4

  1. did you try above?
  2. what are your driver capabilities ?

Hi Aleksei,

Thank you for your response.

I will try to do all steps by tutorial.
Removed the ‘WebdriverAgentRunner’ app from device and reboot device it didn’t help.

My capabilities:
addMobileDesiredCapabilities.setCapability(“cleanSession”, true);
addMobileDesiredCapabilities.setCapability(“ensureCleanSession”, true);
addMobileDesiredCapabilities.setCapability(“useJSONSource”, true);
addMobileDesiredCapabilities.setCapability(“useNewWDA”, false);
addMobileDesiredCapabilities.setCapability(“usePrebuiltWDA”, true);
addMobileDesiredCapabilities.setCapability(“safariGarbageCollect”, true);
addMobileDesiredCapabilities.setCapability(“includeSafariInWebviews”, true);
addMobileDesiredCapabilities.setCapability(“startIWDP”, true);
addMobileDesiredCapabilities.setCapability(“nativeWebTap”, true);
addMobileDesiredCapabilities.setCapability(“useFirstMatch”, true);
addMobileDesiredCapabilities.setCapability(“waitForQuiescence”, false);
addMobileDesiredCapabilities.setCapability(“noReset”, false);
addMobileDesiredCapabilities.setCapability(“fullContextList”, true);
addMobileDesiredCapabilities.setCapability(“clearSystemFiles”, true);
addMobileDesiredCapabilities.setCapability(“newCommandTimeout”, 30000);
addMobileDesiredCapabilities.setCapability(“showXcodeLog”, false);

I have second Early Mac 2015 with the same configuration and everything works.
Only difference is that on M1 appium path: ‘/opt/homebrew/bin/appium’ and on second older Mac appium path: ‘user/local/bin/appium’

= better set it TRUE for VERY first time and all other tests FALSE

  1. I do not see in capabilities xcodeOrgId, xcodeSigningId, udid
  2. how you complete prepare WDA for real device usage?

I set additional capabilities:
addMobileDesiredCapabilities.setCapability(“xcodeOrgId”, “SWQA3DF4FQ”);
addMobileDesiredCapabilities.setCapability(“xcodeSigningId”, “iPhone Developer”);

And created a file ‘.xconfig’ and set content:
DEVELOPMENT_TEAM = SWQA3DF4FQ
CODE_SIGN_IDENTITY = iPhone Developer

Run the test and got the same error message in appium log, and WebDriverAgent didn’t install on iOS device, my app was installed without WebDriverAgent on device

I’m using iOS.yaml file where are set all device config:
serverPort: 8006
appiumProxyPort: 15000
appium:

  • deviceName: iPhone_SE_2020
    udid: 00008030-001E65E90ADB802E
    version: 15.4
    os: IOS
    port: 5235
    userId: 3
    started: true

On empty device:

  1. Appears app under test
  2. Appears WDA app
  3. WDA starts listen appium commands.

You are between 1 and 2 now

Hi, the problem was resolved.

Thank you

hi, how the problem was resolved?

Sign out from xcode account -> uninstall appium -> install appium -> sign in xcode account

Hi Facing this issue for ios 16, xcode 14 build. tried above suggestions still facing the same and this is happening while trying to inspect on simulator

{

“platformName”: “iOS”,
“appium:platformVersion”: “16.0”,
“appium:automationName”: “XCUITest”,
“appium:bundleId”: “com.sap.epm.**”,
“appium:deviceName”: “iPhone 14 Pro Max”
}
Device cap

appium version 1.22.3
xcode version 14.0

appium inspector 2022.8.1

I had the same issue so tried the steps mentioned here
https://www.youtube.com/watch?v=4E_Dcu6Ifc0 and got an error ld: cannot link directly with dylib/framework so found a solution here
https://developer.apple.com/forums/thread/712039 and was suggested to get
latest verison of webdriver agent - https://github.com/appium/WebDriverAgent/releases and I was build for Webdriver agent from Xcode.

After that I was able to launch the app via Appium inspector , hope this helps.

macOS Monterey 12.6(21G115)
Xcode : 14.0.1 (14A400)
Simulator : iPhone 13 Pro with iOS 16.0

2 Likes

Thanks a lot for the suggestions, i tried but i am still facing the issue, i get error 65 even after following the latest version of webdriver agent, do i need it to be replacing the old webdriver agent within the appium content?

1/ Download WebDriverAgent latest version

2/ Go to:

  • By default: /usr/local/lib/node_modules/appium/node_modules/
  • If you use nvm to install node: /Users/UserName/.nvm/versions/node/vx.x.x/lib/node_modules/appium/node_modules/

3/ Remove appium-webdriveragent and replace it with the downloaded new one. It works for me!

2 Likes

Thank you very much @rakeshg and @Dtink by applying both of your suggestions i was able to make it work!

1 Like

This worked for me. Thanks man
you are a legend

Thank you all. I struggled to find a solution. Thanks to the discussion here, the issue solved.

Hi I’m new to this. Could you please explain how this 3. step is exactly done?

I have this in folder appium-webdriveragent:

    Configurations                      WebDriverAgentRunner
    LICENSE                             WebDriverAgentRunner-Runner.app.zip
    PrivateHeaders                      WebDriverAgentTests
    README.md                           build
    Scripts                             index.js
    WebDriverAgent.xcodeproj            lib
    WebDriverAgentLib                   package.json

But downloaded only WebDriverAgentRunner-Runner.app

Many thanks

You could just use Appium 2:

https://www.headspin.io/blog/installing-appium-2-0-and-the-driver-and-plugins-cli

1 Like