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

An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: “xcodebuild failed with code 65”. 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. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 42.41 seconds

This is my code:

package IOSRealDevice;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;

public class TestReal{

public static void main(String[] args) throws MalformedURLException, InterruptedException {
	
	DesiredCapabilities cap = new DesiredCapabilities();
	cap.setCapability("xcodeConfigfile", "Users/karna/Desktop/Config.xcconfig");
            cap.setCapability(MobileCapabilityType.PLATFORM_NAME,"iOS");
	cap.setCapability(MobileCapabilityType.PLATFORM_VERSION,"10.13");
	cap.setCapability(MobileCapabilityType.DEVICE_NAME,"karnaiMac's iPhone");
	cap.setCapability("xcodeOrgId", "added name XXXXX");
	cap.setCapability("xcodeSigningId", "iPhone Developer");

	cap.setCapability("agentPath", "/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj");
	cap.setCapability("bootstrapPath", "/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent");

	cap.setCapability("udid", "iphone udid xxxxxx");
	cap.setCapability("keychainPath", "/Users/karna/Library/Keychains/login.keychain-db");
	cap.setCapability("keychainPassword", "xxxxxx");
	cap.setCapability("automationName", "XCUITest");

    //xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'id=iphone udid' WebDriverAgent

	cap.setCapability(MobileCapabilityType.APP,"/Users/karna/Library/Developer/Xcode/DerivedData/Appname-csixnohoxphlboetngjflnzcatmi/Build/Products/Debug-iphoneos/Appname.app");
	IOSDriver driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"),cap);
	driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);

}

}

Follow the steps in this video and check if it helps

https://youtube.com/watch?v=TprXEKBnfmA

1 Like

Thanks for the response… @Venkatesh_Akula.
I follow the each and every step but still its displaying same error. I need to resolve this error as soon as possible , Please guide me any once.

Did WebDriverAgent showed you ‘Build Succeeded’ in Xcode?

This seem recent problem for me. Last week my dev environment was working just fine. Appium 1.7.1 both UI version and console version were working. I also have iOS11 on my real device iPhone. I have followed these steps many times before and it worked. Yes it compiles in xCode too.

Then today I launch Appium UI and I see an update message. Let it download and restart. Now when I launch a session it either does not work or it takes a crazy long time. Like I gave up waiting, and went to do something else. Then later I see it actually worked. Just too forever.

Finding same thing launching the inspector tool from Appium UI.

Start Server v1.7.1
Click on UI inspector tool icon
See dialog pop up
Select from my pre-saved settings that I have been using for a while now
Start Session

See cute little spinny thing rotating around. Session actually starts on phone. Back on the Mac cute spinny thing still going and going.

Yes @Venkatesh_Akula. Its displaying Build Succeeded. But the WebDriverAgent app is not displaying in mobile.

When you run the test case keep an eye on your Mobile screen, the webdriver agent app will be installed and uninstall immediately. I don’t know the reason for this, but what you should do here is as soon as you see the webdriver agent app installed disconnect the cable from mac

Then in iPhone > Settings > General > Profiles & Device Management

webdriver agent will be listed here > tap on it and click ‘Trust’ option. Come to home screen & click on webdriver agent app once, you should see the app opens & a black screen is displayed.

Reconnect the device and rerun your test cases., it should work.

1 Like

Hello @Venkatesh_Akula @KARUNAKAR Are you able to resolve this issue

I am also getting same problem and could not able to find the root cause, i think i had code sign everything properly but getting the same error

“xcodebuild failed with code 65”. 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.

@venkat4 my issue is resolved, check if this video helps.

https://youtube.com/watch?v=TprXEKBnfmA

1 Like

Thanks to all… My issue also resolved.

@Venkatesh_Akula i tried everything whatever is explained in the video except this (Settings => General => Device Management on the device to trust the developer and allow the WebDriverAgentRunner)

I could not find WebDriverAgent in device management settings to trust it. is there anything else i need to do?
and by the way is it simulator or real device in the video?

** Ensure you trust the developer in your real iPhone else, the app will get deleted as soon as its installed.

When you run the test case keep an eye on your Mobile screen, the webdriver agent app will be installed and uninstall immediately. I don’t know the reason for this, but what you should do here is as soon as you see the webdriver agent app installed disconnect the cable from mac

Then in iPhone - Settings - General - Profiles & Device Management

webdriver agent will be listed here - tap on it and click ‘Trust’ option. Come to home screen & click on webdriver agent app once, you should see the app opens & a black screen is displayed.

Reconnect the device and rerun your test cases., it should work. Try this multiple times until you get it right.

@Venkatesh_Akula When webdriver agent app is installed and then when i removed the cable, i could not find in iPhone - Settings - General - Profiles & Device Management. Tried several times but no luck. is there any other work around

Oh, you have to unplug the cable immediately. You can follow the steps in this link for other ways to make this work.

https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md

Yes followed all the steps but no luck, i am not understanding which configuration or permissions got messed up. I had open ticket, please check for detail info

@venkat4 Guys, it happens when setup for appium have some problem in configuring webdriver-agent in appium library, you can even configure webdriver-agent with free apple developer account as well, follow these steps in video: https://www.youtube.com/watch?v=dyijACVRQOc
It worked for me, hope it will help everybody here!
Still you find any problem, comment on that video, they will follow :slight_smile: Happy testing:)

I am able to launch WebDriverAgentRunner but it just opens and closes with appium logs as below:


[Xcode] 2018-03-26 15:44:15.722 xcodebuild[60272:1079899] Error Domain=IDETestOperationsObserverErrorDomain Code=6 “Early unexpected exit, operation never finished bootstrapping - no restart will be attempted” UserInfo={NSLocalizedDescription=Early unexpected exit, operation never finished bootstrapping - no restart will be attempted}
[Xcode]
[Xcode] ** TEST EXECUTE FAILED **
[Xcode]
[Xcode]
[Xcode] 2018-03-26 15:44:15.558835+1100 WebDriverAgentRunner-Runner[340:134041] +[CATransaction synchronize] called within transaction
[Xcode] 2018-03-26 15:44:15.620290+1100 WebDriverAgentRunner-Runner[340:134041] Running tests…
[Xcode] 2018-03-26 15:44:15.665479+1100 WebDriverAgentRunner-Runner[340:134041] The bundle “WebDriverAgentRunner” couldn’t be loaded because its executable couldn’t be located. Try reinstalling the bundle.
[Xcode]
[XCUITest] xcodebuild exited with code ‘65’ and signal ‘null’
[BaseDriver] Event ‘wdaStartFailed’ logged at 1522039455748 (15:44:15 GMT+1100 (AEDT))
[XCUITest] Unable to launch WebDriverAgent because of xcodebuild failure: “xcodebuild failed with code 65”. 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.
[XCUITest] Quitting and uninstalling WebDriverAgent, then retrying
[XCUITest] Shutting down sub-processes
[XCUITest] Shutting down iproxy process (pid 60271)
[XCUITest] iproxy exited with code ‘null’
[XCUITest] Removing WDA application from device
[XCUITest] Error: Unable to launch WebDriverAgent because of xcodebuild failure: “xcodebuild failed with code 65”. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md.


But when executing using a simulator, the test executes successfully.

@villaoj Experiencing the same issue. Did you get any solution for the same?
Appium Desktop: 1.15.1
iPhone XR: 13.5(real device)
Xcode: 11.7

I have already tried below mentioned steps but issue didn’t resolve:

  1. Getting ‘Build Succeeded’ for WebDriverAgent in Xcode
  2. Changed the Dev id in Xcode
  3. Updated Product bundle identifier in build setting of WebDriverAgent Runner in Xcode
  4. Trusted the certificate under Setting->General->Device & Management but it’s disappearing after uninstalling the WDA(automatically).