3

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)
SaiPawan
  • 1,189
  • 7
  • 20
MoNa
  • 365
  • 4
  • 13
  • 31

8 Answers8

5

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

tiredqa_18
  • 162
  • 2
  • 9
2

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

SaiPawan
  • 1,189
  • 7
  • 20
2

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.

MoNa
  • 365
  • 4
  • 13
  • 31
1

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

0

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.

Saw Pyae
  • 269
  • 4
  • 9
0

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

0

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

Vikas Piprade
  • 272
  • 2
  • 7
0

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.