Not able to setup Appium XCUItest framework for iOS device

Hi Guys,

I am trying to setup my real ios device with appium (version 1.20.0) for which i installed appium via npm i -g [email protected]

Then i installed appium desktop version 1.20.0
after that i tried going to the package content “/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appiu-webdriveragent”

and tried to run the ./Scripts/bootstrap.sh which game me a result dependencies are up to date.

than i tried to open the webdriveragent xcode project in xcode and tried to build it on my phone after signing the code.
I just got the IntegrationApp installed on my device and when i am trying to start appium session iam getting an error.

“An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 70 xcodebuild error message: . 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.”

Can someone please help me with this?

pre conditions:

  • use LATEST xCode version if you having latest iOS version on phone.

steps with command line appium:

  1. remove anything old: npm uninstall -g appium
  2. install new: npm install -g appium
  3. navigate to “/Users/YOUR_USER_NAME/Library/Developer/Xcode/DerivedData” with Finder and delete all data. this is a temp folder where WDA building and store temp data.
  4. navigate to appium wda folder in terminal:
    cd /usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent
  5. I like follow ‘Full manual configuration’ part of the doc
    • execute: mkdir -p Resources/WebDriverAgent.bundle
    • now open ‘WebDriverAgent.xcodeproj’ in xCode
    • add your developer signature to ‘WebDriverRunner’:
    • in header select ‘WebDriverRunner’ to build for ANY iOS device. This will make universal build for any iPhone: image
    • now build WDA using ‘Build’ button: image
  6. after successful build you may double check that file created in ‘DerivedData’ folder:
    image

now you are ready to start Appium tests on real device

1 Like

Hi Alek,

Thank you for the response.

I tried all the steps you have mentioned above and the webdriveragentrunner build showed me succeeded.

But when i am trying to open the Appium inspector and providing all the desired capabilities mentioned below:

{
“platformName”: “iOS”,
“platformVersion”: “14.5”,
“deviceName”: “iPhone”,
“automationName”: “XCUITest”,
“app”: “/Users/dkviksar/Downloads/test.ipa”,
“udid”: “0000xxxxxx”
}
and i clicked start sesssion.

The test app is installed on my machine and then the same error i was getting before is thrown:

“An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 70 xcodebuild error message: . 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.”

Dont understand where i am going wrong with the installation.Any help would be highly appreciated.

1 Like

“Appium Inspector” is another program. And it has own WDA path.
I mentioned way when you start appium server in code.
All is needed for you to find “Appium Inspector” path to “appium-webdriveragent”. I believe it should be inside “Appium Inspector” app program.

Hi Aleksei,

I tried with the code as well and getting the same error:

“org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: xcodebuild failed with code 70”

Please find my testscript below:
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.remote.DesiredCapabilities;

import java.net.MalformedURLException;
import java.net.URL;

public class baseclass {

 static AppiumDriver<MobileElement> driver;
@BeforeClass
public static void setup() throws MalformedURLException {
    DesiredCapabilities caps=new DesiredCapabilities();
    caps.setCapability(MobileCapabilityType.PLATFORM_NAME,"iOS");
    caps.setCapability(MobileCapabilityType.PLATFORM_VERSION,"14.5");
    caps.setCapability(MobileCapabilityType.UDID,"0000xxx");
    caps.setCapability(MobileCapabilityType.DEVICE_NAME,"iPhone");
    caps.setCapability(MobileCapabilityType.AUTOMATION_NAME,"XCUITest");
    caps.setCapability(MobileCapabilityType.APP,"/Users/username/IdeaProjects/TestMaven/src/test/Resources/apps/Test.ipa");

    URL url=new URL("http://127.0.0.1:4723/wd/hub");
    driver =new AppiumDriver<MobileElement>(url,caps);
    //driver=new IOSDriver<MobileElement>(url,caps);
}

@Test
public void sampletest(){
    System.out.println(" i am inside test");
}
@AfterClass
public static void teardown(){
driver.close();
}

}

xcodebuild error message:

It is not clear. You installed appium with npm command and build wda. Then in terminal now you started appium with command ‘appium’ or ‘appium --port 4723’. After this now you starting your test. Correct?

I tried starting Appium with command ‘appium’ on the terminal
and also tried appium --port 4723 and got the same error:

Please find the attached appium server log Appium-serverLog1762.txt (13.5 KB) :

  1. does the phone itself enabled for automation?
  2. does this phone included into developer certificate you signed WDA app?
  3. when you first connected phone to mac you confirmed Trusted on phone and mac?

How do i check if the phone is enable for automation?
I think my phone is not included in the Developer Certificate that i have singed WDA app. Does that mean not enabled for automation?

Yes i clicked trusted on phone when i connected to my mac.

Despite of all this i still do not understand how my AUT gets installed on the phone though.

ask developers to include our phone into developer certificate

Hi Aleksei,

i got my device added to Apple development team and tried to build WebdriverAgentRunner again, build succeeded. But when i run my test i am still getting the same error.

Can you please help?

what you see on phone? first test app installs, then installs WDA app on phone and then error in logs coming. correct?

Got it working after uninstalling and installing Appium and follwing the steps

Sir I am facing the same issue. can you please help me out