Unable to launch WebDriverAgent

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent because of xcodebuild failure: Unable to start WebDriverAgent: Error: We were not able to retrieve the /status response from the WebDriverAgent server after 3000ms timeout.Try to increase the value of ‘appium:wdaLaunchTimeout’ capability as a possible workaround.

This is the error I get after the application is installed on simulator programatically, and the WebDriverAgent is not started.

[AppiumDriver@1e90] Encountered internal error running command: Error: Unable to launch WebDriverAgent because of xcodebuild failure: Unable to start WebDriverAgent: Error: We were not able to retrieve the /status response from the WebDriverAgent server after 3000ms timeout.

macOs Sonoma14.2.1
Xcode 15.2

appium -v
2.4.0

appium driver list --installed
:heavy_check_mark: Listing installed drivers

  • [email protected] [installed (npm)]

    public DesiredCapabilities setCaps() {
    capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, “iOS”);
    capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, “15.4”);
    capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, “XCUITest”);
    capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, “iPhone 13 Pro”);
    // capabilities.setCapability(MobileCapabilityType.NO_RESET,“false”);
    String appUrlIos = System.getProperty(“user.dir”) + “/src/app/swift/abc.app”;
    capabilities.setCapability(“app”, appUrlIos);
    capabilities.setCapability(“wdaLaunchTimeout”, 3000);
    return capabilities;
    }

Was it working before?
Looks like issue with webdriver configuration when setting up Appium. You need to configure it properly in order to use it with simulator or real device. You can follow the steps from appium website or from this video -

Yes, the automated tests worked until I installed Xcode 15 and appium 2.3.0
After that I try to find compatible versions.

Do you know if these commands are enough to uninstall the appium?
npm uninstall -g appium
npm cache clean --force

So in order to clear WDA I must reinstall xcuitest driver?

Thank you!

Hello ,

I am also facing same issue while launching the agent .here the IPA file is successfully installed but the time it should install the runner app and launch the agent same error as mentioned in description is appeared.
System Details :-
Mac OS :- Sonoma 14.4 (23E214)
Xcode :- 15.2 and even updated to 15.3
Appium - 2.5.1
Node -21.7.1
npm -10.5.0
IPAD with IOS :-17.4

Please suggest

Below are the log details for your reference :-

XCUITestDriver@d422] Matched ‘/status’ to command name ‘getStatus’
[XCUITestDriver@d422] Proxying [GET /status] to [GET http://127.0.0.1:8121/status] with no body
[XCUITestDriver@d422] connect ECONNREFUSED 127.0.0.1:8121
[XCUITestDriver@d422] Matched ‘/status’ to command name ‘getStatus’
[XCUITestDriver@d422] Proxying [GET /status] to [GET http://127.0.0.1:8121/status] with no body
[XCUITestDriver@d422] connect ECONNREFUSED 127.0.0.1:8121
[XCUITestDriver@d422] Matched ‘/status’ to command name ‘getStatus’
[XCUITestDriver@d422] Proxying [GET /status] to [GET http://127.0.0.1:8121/status] with no body
[XCUITestDriver@d422] connect ECONNREFUSED 127.0.0.1:8121
[XCUITestDriver@d422] Matched ‘/status’ to command name ‘getStatus’
[XCUITestDriver@d422] Proxying [GET /status] to [GET http://127.0.0.1:8121/status] with no body
[XCUITestDriver@d422] connect ECONNREFUSED 127.0.0.1:8121
[XCUITestDriver@d422] Error: Unable to connect to running WebDriverAgent: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8121
[XCUITestDriver@d422] at /Users/admin/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/lib/xcodebuild.js:393:17
[XCUITestDriver@d422] at processTicksAndRejections (node:internal/process/task_queues:95:5)
[XCUITestDriver@d422] at wrapped (/Users/admin/.appium/node_modules/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:93:13)
[XCUITestDriver@d422] at retry (/Users/admin/.appium/node_modules/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:66:13)
[XCUITestDriver@d422] at retryInterval (/Users/admin/.appium/node_modules/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:103:10)
[XCUITestDriver@d422] at XcodeBuild.waitForStart (/Users/admin/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/lib/xcodebuild.js:377:7)
[XCUITestDriver@d422] at /Users/admin/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/lib/xcodebuild.js:359:26
[XCUITestDriver@d422] Unable to start WebDriverAgent: Error: We were not able to retrieve the /status response from the WebDriverAgent server after 60000ms timeout.Try to increase the value of ‘appium:wdaLaunchTimeout’ capability as a possible workaround.
[XCUITestDriver@d422] Matched ‘/status’ to command name ‘getStatus’
[XCUITestDriver@d422] Proxying [GET /status] to [GET http://127.0.0.1:8121/status] with no body
[XCUITestDriver@d422] connect ECONNREFUSED 127.0.0.1:8121
[XCUITestDriver@d422] Matched ‘/status’ to command name ‘getStatus’
[XCUITestDriver@d422] Proxying [GET /status] to [GET http://127.0.0.1:8121/status] with no body
[XCUITestDriver@d422] connect ECONNREFUSED 127.0.0.1:8121
[XCUITestDriver@d422] Matched ‘/status’ to command name ‘getStatus’
[XCUITestDriver@d422] Proxying [GET /status] to [GET http://127.0.0.1:8121/status] with no body
[XCUITestDriver@d422] connect ECONNREFUSED 127.0.0.1:8121
[XCUITestDriver@d422] Error: Unable to connect to running WebDriverAgent: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:8121
[XCUITestDriver@d422] at /Users/admin/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/lib/xcodebuild.js:393:17
[XCUITestDriver@d422] at processTicksAndRejections (node:internal/process/task_queues:95:5)
[XCUITestDriver@d422] at wrapped (/Users/admin/.appium/node_modules/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:93:13)
[XCUITestDriver@d422] at retry (/Users/admin/.appium/node_modules/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:66:13)
[XCUITestDriver@d422] at retryInterval (/Users/admin/.appium/node_modules/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:103:10)
[XCUITestDriver@d422] at XcodeBuild.waitForStart (/Users/admin/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/lib/xcodebuild.js:377:7)
[XCUITestDriver@d422] at /Users/admin/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/lib/xcodebuild.js:359:26
[XCUITestDriver@d422] Unable to start WebDriverAgent: Error: We were not able to retrieve the /status response from the WebDriverAgent server after 60000ms timeout.Try to increase the value of ‘appium:wdaLaunchTimeout’ capability as a possible workaround.

I had the same issue updated to Xcode 15.3 and iOS appium tests stopped working.
Infact cannot create a new session via Appium inspector too
And my Android test would run fine

I fixed it with below steps
updated appium server to 2.5.1 (still issue persisted)
updated xcuitest appium → driver update xcuitest (to latest, still the issue persisted)
updated appium java client dependency to 9.2.2 (still issue persisted)

Now apple been apple when you update Xcode does not really update the iOS version in my case to iOS 17.4 screenshot below, so go Xcode > Settings

Once the update is done on your simulator you will get options to choose iOS version
I choose the latest update
Screenshot 2024-03-31 at 11.00.35 AM

please note the udid changes so I had to now get latest udid
xcrun simctl list
and also choose the one from the latest iOS version in mycase iOS 17.4

update the udid in my test and finally it worked.

Thanks Apple :slight_smile:

Hope this helps anyone who faced a similar issue

1 Like