MoNa
MoNa

Reputation: 471

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

I am trying to run appium scripts with below setup:

Appium version : 1.6.4
Xcode : 8.3.2
Mac : 10.12.4
iPhone : 10.3.1

Below is the code I am using to launch safari Browser on iPhone real device.

desCapabilities = new DesiredCapabilities();
desCapabilities.setCapability("platformName","iOS");
desCapabilities.setCapability("deviceName", "Ananda's iPhone");
desCapabilities.setCapability("platformVersion", "10.3.1");
desCapabilities.setCapability("app", "com.apple.mobilesafari");
desCapabilities.setCapability("udid", "******");
iOSDriver = new IOSDriver<MobileElement>(new URL("http://" + nodeUrl + ":" + nodeUrlPort + "/wd/hub"), desCapabilities);

I am getting the error and please find the logs below:

[MJSONWP] Encountered internal error running command: Error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65
at XCUITestDriver.quitAndUninstall$ (../../lib/driver.js:374:15)
at tryCatch (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/usr/local/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at process._tickCallback (internal/process/next_tick.js:109:7)

Upvotes: 3

Views: 48212

Answers (11)

user6502515
user6502515

Reputation: 253

Can try these: Install appium version: 2.0.0-beta.46

npm install -g appium@next

Then install the driver for xcuitest:

appium driver install xcuitest

Go to the folder: /Users/${your_user}/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent

If yo have issues with signing, then open WebDriverAgent.xcodeproj with xCode and sign it.

Then run the command:

xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id='{device_id}' test -allowProvisioningUpdates

Upvotes: 0

I managed to solve this error this way: You need to install the webdriver on your simulator. To do this, follow the steps described in the documentation https://appium.github.io/appium-xcuitest-driver/4.24/wda-custom-server/

Important: Select WebDriverAgentRunner project and build his with button Test (like on the screen https://prnt.sc/6CTaW_InJK2v). After that when you launch session on Appium, webdriver agent will install on your simulator and fixed error.

Upvotes: 0

harsh saxena
harsh saxena

Reputation: 1

Getting error : with new webdriveragent 8.5.6 ios -17.4.1 appium - latest xcode - 15.3 i have replaced the webdriveragent folder (except build) in appium -GUI server - open packages - node modules. the xcode build gets successful but appium inspector gives error strong text

Upvotes: -1

Bisweswar Swain
Bisweswar Swain

Reputation: 11

I ran into the same problem with iOS 16.4. Here is how I solved it:

1- In case of any OS upgrade(iOS), the framework gets disturbed as the other apps(Appium version/xcode/mac os) become unsupported. We need to make sure all the apps and OS should be compativle for the updated iOS version, we need to upgrade xcode as well as Mac OS(for latest xcode version, if required).

2- We might get errors like ‘Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 65’ or ‘A valid provisioning profile for this executable was not found.’

3- Check the signing and capabilities for webdriveragentrunner and webdriveragentlib, it should be signed in using a proper developer account

4- Try running the tests again and check if the error isn’t coming anymore. In case the same errors still comes we need to do the next steps mentioned below

5- In such cases we can download the latest webdriver agent from ‘https://github.com/appium/WebDriverAgent/releases’

6- Then delete all files except Build folder from appium gui’s webdriver agent folder

7- From the downloaded folder we can copy all files and paste inside the appium gui’s webdriver agent folder

It worked for me.

Upvotes: 0

Vikas Piprade
Vikas Piprade

Reputation: 352

The reason for this error is that WebDriverAgent not configured [ or installed] properly before launching the app via Appium .

For this, WebDriverAgent needs to be executed once on the iOS Simulator or real device before running tests

Please run the WebDriverAgent Xcode project which is located here on your Mac: /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj

In this Xcode project follow the below steps to build the WebDriverAgentRunner:

[1] Select the WebDriverAgentRunner as active Scheme

[2] Select the iPhone Simulator.

[3] Make sure the runner is signed and Select your team under ‘Signing & Capabilities’ settings of the project

[4] Build and Run the WebDriverAgentRunner runner on simulator by selecting Product > Test from the Xcode menu’s bar

[5] Once Runner is successfully installed on the device, Simulator is ready for launching the app via appium

Upvotes: 0

The below solution helped me to resolve the issue:

  1. Download the latest web driver agent from the link:

    WebdriverAgent 4.9.0

    WebdriverAgent all releases

  2. Go to the Appium desktop and locate webdriveragent
 :
    $APPIUM_HOME/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent.

  3. Delete the entire appium-webdriveragent folder from the above location in mac.

  4. Paste the webdriveragent-4.9.0 folder downloaded from the above link.

  5. Change the name of the webdriveragent folder name to “appium-webdriveragent”.

Version Used: Appium Desktop v1.22.3 || MacOS Ventura 13.2.1 || Xcode v14.2

Upvotes: 1

Rakesh Karkare
Rakesh Karkare

Reputation: 91

Common reason for the Appium launch failing with the specified reason is the WebDriverAgent not configured properly before launching the app via Appium .

Found Solution below, which helped me to solve the issue

https://sqa.stackexchange.com/questions/50678/run-iphone-simulator-with-appiume-but-get-xcodebuild-failed-with-code-65-xcodebu

Upvotes: 0

tiredqa_18
tiredqa_18

Reputation: 331

In case anyone is having this issue with xcode 14 and above, doing the below should work:

  • download new webdriveragent version 4.9.0 and above. https://github.com/appium/WebDriverAgent/releases
  • go to appium desktop (if any) and appium installed via terminal node modules folder
  • in appium-webdriveragent folder, replace everything with the new downloaded webdriveragent except for build folder

reference: https://github.com/appium/appium/issues/17497#issuecomment-1275191319

Upvotes: 5

Saw Pyae
Saw Pyae

Reputation: 269

This issue took me four days to solve ^_^.

First approach, do not update appium from terminal. Try uninstall and install

  1. npm uninstall -g appium

  2. npm install -g appium

Second approach, run appium from terminal instead of UI appium .

Third approach,

If you still get the this error in Appium Desktop Application, Pls check , Do you install multiple xcode version? When I tried above two approaches, my personal experience was that it didn't work cause appium use latest xcode path ( in appium release note, latest xcode 12.3 does not support yet). So I changed the old xcode path by using

sudo xcode-select -s /Applications/Xcode12.2.app/Contents/Developer

Fortunately it works fine.

Upvotes: 0

MoNa
MoNa

Reputation: 471

By following the below steps I have launched the safari browser on iOS real device using Appium.

  1. We need to install WebDriverAgent on Mac using Terminal.

    xcodebuild build test -project /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id= -configuration Debug

  2. Run the below command to Open the WebDriverAgent using Xcode.

    open /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj

  3. In Xcode, select the "Automatically manage signing" checkbox for both WebDriverAgent and WebDriverAgentLib.

  4. Run the Xcode Project.

  5. Once build succeed, WebDriverAgent app will be installed in iPhone device.

  6. Finally Run the Selenium code to Launch Safari Browser.

Upvotes: 2

SaiPawan
SaiPawan

Reputation: 1194

It is opening WebDriverAgent application in the device.Go through below link and configure the WebDriverAgent app for your phone.

Unable to launch ipa file in IOS 10 real Device using appium 1.6.0

Upvotes: 2

Related Questions