I updated WDA to 9.3.1 but it still doesn’t work. This is the server output:
(base) user@users-MacBook-Air ~ % appium
[Appium] Welcome to Appium v2.17.1
[Appium] The autodetected Appium home path: /Users/user/.appium
[Appium] Attempting to load driver xcuitest...
[Appium] Attempting to load driver uiautomator2...
[Appium] Requiring driver at /Users/user/.appium/node_modules/appium-xcuitest-driver/build/index.js
[Appium] Requiring driver at /Users/user/.appium/node_modules/appium-uiautomator2-driver/build/index.js
[Appium] AndroidUiautomator2Driver has been successfully loaded in 0.450s
[Appium] XCUITestDriver has been successfully loaded in 0.971s
[Appium] Appium REST http interface listener started on http://0.0.0.0:4723
[Appium] You can provide the following URLs in your client code to connect to this server:
http://127.0.0.1:4723/ (only accessible from the same host)
[Appium] Available drivers:
[Appium] - [email protected] (automationName 'XCUITest')
[Appium] - [email protected] (automationName 'UiAutomator2')
[Appium] No plugins have been installed. Use the "appium plugin" command to install the one(s) you want to use.
[HTTP] --> POST /session {"capabilities":{"alwaysMatch":{"platformName":"iOS","appium:deviceName":"...","appium:platformVersion":"18.1.1","appium:automationName":"XCUITest","appium:udid":"...","appium:webDriverAgentUrl":"http://localhost:7700","appium:settings":{"limitXPathContextScope":false}},"firstMatch":[{}]},"desiredCapabilities":{"platformName":"iOS","appium:deviceName":"...","appium:platformVersion":"18.1.1","appium:automationName":"XCUITest","appium:udid":"...","appium:webDriverAgentUrl":"http://localhost:7700","appium:settings":{"limitXPathContextScope":false}}}
[AppiumDriver@3ef4] Calling AppiumDriver.createSession() with args: [{"platformName":"iOS","appium:deviceName":"...","appium:platformVersion":"18.1.1","appium:automationName":"XCUITest","appium:udid":"...","appium:webDriverAgentUrl":"http://localhost:7700","appium:settings":{"limitXPathContextScope":false}},null,{"alwaysMatch":{"platformName":"iOS","appium:deviceName":"...","appium:platformVersion":"18.1.1","appium:automationName":"XCUITest","appium:udid":"...","appium:webDriverAgentUrl":"http://localhost:7700","appium:settings":{"limitXPathContextScope":false}},"firstMatch":[{}]}]
[Appium] Attempting to find matching driver for automationName 'XCUITest' and platformName 'iOS'
[Appium] The 'xcuitest' driver was installed and matched caps.
[Appium] Will require it at /Users/user/.appium/node_modules/appium-xcuitest-driver
[Appium] Requiring driver at /Users/user/.appium/node_modules/appium-xcuitest-driver/build/index.js
[AppiumDriver@3ef4] Appium v2.17.1 creating new XCUITestDriver (v9.0.0) session
[AppiumDriver@3ef4] Checking BaseDriver versions for Appium and XCUITestDriver
[AppiumDriver@3ef4] Appium's BaseDriver version is 9.16.4
[AppiumDriver@3ef4] XCUITestDriver's BaseDriver version is 9.16.4
[XCUITestDriver@497d]
[XCUITestDriver@497d] Creating session with W3C capabilities: {
"alwaysMatch": {
"platformName": "iOS",
"appium:deviceName": "...",
"appium:platformVersion": "18.1.1",
"appium:automationName": "XCUITest",
"appium:udid": "...",
"appium:webDriverAgentUrl": "http://localhost:7700"
},
"firstMatch": [
{}
]
}
[XCUITestDriver@497d] The desired capabilities include neither an app nor a bundleId. WebDriverAgent will be started without the default app
[4b93d814][XCUITestDriver@497d] Session created with session id: 4b93d814-cdfa-4da9-ba26-a5b1eb4fa2cf
[4b93d814][XCUITest] Current user: 'user'
[4b93d814][XCUITestDriver@497d] Skipping checking of the real devices availability since the session specifies appium:webDriverAgentUrl
[4b93d814][XCUITestDriver@497d] Creating iDevice object with udid '...'
[4b93d814][XCUITestDriver@497d] Determining device to run tests on: udid: '...', real device: true
[4b93d814][XCUITestDriver@497d] Normalized platformVersion capability value '18.1.1' to '18.1'
[4b93d814][XCUITestDriver@497d] Reset: running ios real device reset flow
[4b93d814][XCUITestDriver@497d] Using WDA path: '/Users/user/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent'
[4b93d814][XCUITestDriver@497d] Using WDA agent: '/Users/user/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj'
[4b93d814][XCUITestDriver@497d] The pyidevice tool is not present in PATH. Skipping crash logs collection for real devices.
[4b93d814][XCUITestDriver@497d] Setting up real device
[4b93d814][DevCon Factory] Requesting connection for device ... on local port 7700
[4b93d814][DevCon Factory] Cached connections count: 0
[4b93d814][DevCon Factory] Successfully requested the connection for ...:7700
[4b93d814][XCUITestDriver@497d] Starting WebDriverAgent initialization with the synchronization key 'XCUITestDriver'
[4b93d814][XCUITestDriver@497d] Trying to start WebDriverAgent once since at least one of webDriverAgentUrl,usePreinstalledWDA capabilities is provided
[4b93d814][XCUITestDriver@497d] Using provided WebdriverAgent at 'http://localhost:7700'
[4b93d814][XCUITestDriver@497d] JWProxy options: {"server":"localhost","port":7700,"base":"","timeout":240000,"keepAlive":true,"scheme":"http","reqBasePath":"","sessionId":null}
[4b93d814][XCUITestDriver@497d] NoSessionProxy options: {"server":"localhost","port":7700,"base":"","timeout":240000,"keepAlive":true,"scheme":"http","reqBasePath":"","sessionId":null}
[4b93d814][WD Proxy] NoSessionProxy options: {"server":"localhost","port":"7700","base":"","timeout":3000,"scheme":"http","reqBasePath":"","sessionId":null}
[4b93d814][WD Proxy] Matched '/status' to command name 'getStatus'
[4b93d814][WD Proxy] Proxying [GET /status] to [GET http://localhost:7700/status] with no body
[4b93d814][WD Proxy] Got response with status 200: {"value":{"build":{"version":"9.3.1","time":"Mar 26 2025 19:21:53","productBundleIdentifier":"com.facebook.WebDriverAgentRunner"},"os":{"testmanagerdVersion":65535,"name":"iOS","sdkVersion":"18.0","version":"18.1.1"},"device":"iphone","ios":{"ip":"..."},"message":"WebDriverAgent is ready to accept commands","state":"success","ready":true},"sessionId":"483D93A1-3AF8-456A-A89F-90B6C416B3D1"}
[4b93d814][XCUITestDriver@497d] Sending createSession command to WDA
[4b93d814][XCUITestDriver@497d] Matched '/session' to command name 'createSession'
[4b93d814][XCUITestDriver@497d] Proxying [POST /session] to [POST http://localhost:7700/session] with body: {"capabilities":{"firstMatch":[{"arguments":[],"environment":{},"eventloopIdleDelaySec":0,"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true,"shouldTerminateApp":true,"forceAppLaunch":true,"useNativeCachingStrategy":true,"forceSimulatorSoftwareKeyboardPresence":true}],"alwaysMatch":{}}}
[4b93d814][XCUITestDriver@497d] Got response with status 200: {"value":{"sessionId":"3045F611-FC8E-42F7-AB33-9A95BBCFD385","capabilities":{"sdkVersion":"18.1.1","device":"iphone"}},"sessionId":"3045F611-FC8E-42F7-AB33-9A95BBCFD385"}
[4b93d814][XCUITestDriver@497d] Determined the downstream protocol as 'W3C'
[4b93d814][XCUITestDriver@497d] WDA session startup took 7ms
[4b93d814][BaseDriver] The value of 'elementResponseAttributes' setting did not change. Skipping the update for it
[4b93d814][BaseDriver] The value of 'shouldUseCompactResponses' setting did not change. Skipping the update for it
[4b93d814][XCUITestDriver@497d] Forwarding MJPEG server port 9100 to local port 9100
[4b93d814][DevCon Factory] Requesting connection for device ... on local port 9100, device port 9100
[4b93d814][DevCon Factory] Cached connections count: 1
[4b93d814][DevCon Factory] Successfully requested the connection for ...:9100
[4b93d814][AppiumDriver@3ef4] New XCUITestDriver session created successfully, session 4b93d814-cdfa-4da9-ba26-a5b1eb4fa2cf added to master session list
[4b93d814][AppiumDriver@3ef4] Applying the initial values to Appium settings parsed from W3C caps: {"limitXPathContextScope":false}
[4b93d814][XCUITestDriver@497d] Matched '/appium/settings' to command name 'updateSettings'
[4b93d814][XCUITestDriver@497d] Proxying [POST /appium/settings] to [POST http://localhost:7700/session/3045F611-FC8E-42F7-AB33-9A95BBCFD385/appium/settings] with body: {"settings":{"limitXPathContextScope":false}}
[4b93d814][XCUITestDriver@497d] Got response with status 200: {"value":{"mjpegFixOrientation":false,"boundElementsByIndex":false,"mjpegServerFramerate":1,"maxTypingFrequency":60,"reduceMotion":true,"respectSystemAlerts":false,"elementResponseAttributes":"type,label","screenshotQuality":3,"mjpegScalingFactor":10,"screenshotOrientation":"auto","keyboardPrediction":0,"defaultActiveApplication":"auto","mjpegServerScreenshotQuality":1,"defaultAlertAction":"","keyboardAutocorrection":0,"useFirstMatch":false,"limitXpathContextScope":true,"shouldUseCompactResponses":true,"dismissAlertButtonSelector":"","activeAppDetectionPoint":"64.00,64.00","useClearTextShortcut":true,"snapshotMaxDepth":50,"waitForIdleTimeout":10,"includeNonModalElements":false,"acceptAlertButtonSelector":"","animationCoolOffTimeout":2},"sessionId":"3045F611-FC8E-42F7-AB33-9A95BBCFD385"}
[4b93d814][XCUITestDriver@497d] Cached the protocol value 'W3C' for the new session 4b93d814-cdfa-4da9-ba26-a5b1eb4fa2cf
[4b93d814][XCUITestDriver@497d] Responding to client with driver.createSession() result: {"capabilities":{"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"networkConnectionEnabled":false,"platformName":"iOS","deviceName":"...","platformVersion":"18.1","automationName":"XCUITest","udid":"...","webDriverAgentUrl":"http://localhost:7700"}}
[4b93d814][HTTP] <-- POST /session 200 385 ms - 447
[4b93d814][HTTP] --> POST /session/4b93d814-cdfa-4da9-ba26-a5b1eb4fa2cf/element {"using":"xpath","value":"//XCUIElementTypeButton[@name=\"Start\"]"}
[4b93d814][XCUITestDriver@497d] Calling AppiumDriver.findElement() with args: ["xpath","//XCUIElementTypeButton[@name=\"Start\"]","4b93d814-cdfa-4da9-ba26-a5b1eb4fa2cf"]
[4b93d814][XCUITestDriver@497d] Executing command 'findElement'
[4b93d814][XCUITestDriver@497d] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id, css selector
[4b93d814][XCUITestDriver@497d] Waiting up to 0 ms for condition
[4b93d814][XCUITestDriver@497d] Matched '/element' to command name 'findElement'
[4b93d814][XCUITestDriver@497d] Proxying [POST /element] to [POST http://localhost:7700/session/3045F611-FC8E-42F7-AB33-9A95BBCFD385/element] with body: {"using":"xpath","value":"//XCUIElementTypeButton[@name=\"Start\"]"}
[4b93d814][XCUITestDriver@497d] Got response with status 200: {"value":{"ELEMENT":"1B000000-0000-0000-175C-010000000000","element-6066-11e4-a52e-4f735466cecf":"1B000000-0000-0000-175C-010000000000"},"sessionId":"3045F611-FC8E-42F7-AB33-9A95BBCFD385"}
[4b93d814][XCUITestDriver@497d] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"1B000000-0000-0000-175C-010000000000","ELEMENT":"1B000000-0000-0000-175C-010000000000"}
[4b93d814][HTTP] <-- POST /session/4b93d814-cdfa-4da9-ba26-a5b1eb4fa2cf/element 200 564 ms - 137
[4b93d814][HTTP] --> POST /session/4b93d814-cdfa-4da9-ba26-a5b1eb4fa2cf/element/1B000000-0000-0000-175C-010000000000/element {"using":"xpath","value":"./.."}
[4b93d814][XCUITestDriver@497d] Calling AppiumDriver.findElementFromElement() with args: ["xpath","./..","1B000000-0000-0000-175C-010000000000","4b93d814-cdfa-4da9-ba26-a5b1eb4fa2cf"]
[4b93d814][XCUITestDriver@497d] Executing command 'findElementFromElement'
[4b93d814][XCUITestDriver@497d] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id, css selector
[4b93d814][XCUITestDriver@497d] Waiting up to 0 ms for condition
[4b93d814][XCUITestDriver@497d] Matched '/element/1B000000-0000-0000-175C-010000000000/element' to command name 'findElementFromElement'
[4b93d814][XCUITestDriver@497d] Proxying [POST /element/1B000000-0000-0000-175C-010000000000/element] to [POST http://localhost:7700/session/3045F611-FC8E-42F7-AB33-9A95BBCFD385/element/1B000000-0000-0000-175C-010000000000/element] with body: {"using":"xpath","value":"./.."}
[4b93d814][XCUITestDriver@497d] Got response with status 500: {"value":{"error":"unknown error","message":"Cannot evaluate results for XPath expression \"./..\"","traceback":"(\n\t0 CoreFoundation 0x000000018fce07d8 1532D3D8-9B3B-3F2F-B35F-55A20DDF411B + 534488\n\t1 libobjc.A.dylib 0x000000018cfb32e4 objc_exception_throw + 88\n\t2 WebDriverAgentLib 0x00000001040f2fa8 +[FBXPath xmlStringWithRootElement:options:] + 0\n\t3 WebDriverAgentLib 0x00000001040f3ac0 +[FBXPath matchesWithRootElement:forQuery:] + 1616\n\t4 WebDriverAgentLib 0x000000010410d1a4 -[XCUIElement(FBFind) fb_descendantsMatchingXPathQuery:shouldReturnAfterFirstMatch:] + 152\n\t5 WebDriverAgentLib 0x000000010414dbdc +[FBFindElementCommands elementsUsing:withValue:under:shouldReturnAfterFirstMatch:] + 756\n\t6 WebDriverAgentLib 0x000000010414d888 +[FBFindElementCommands elementUsing:withValue:under:] + 132\n\t7 WebDriverAgentLib 0x000000010414d...
[4b93d814][W3C] Matched W3C error code 'unknown error' to UnknownError
[4b93d814][XCUITestDriver@497d] Encountered internal error running command: NoSuchElementError: An element could not be located on the page using the given search parameters.
at XCUITestDriver.doNativeFind (/Users/user/.appium/node_modules/appium-xcuitest-driver/lib/commands/find.js:143:13)
at processTicksAndRejections (node:internal/process/task_queues:105:5)
at XCUITestDriver.findNativeElementOrElements (/Users/user/.appium/node_modules/appium-xcuitest-driver/lib/commands/find.js:97:12)
at XCUITestDriver.findElOrEls (/Users/user/.appium/node_modules/appium-xcuitest-driver/lib/commands/find.js:24:14)
at XCUITestDriver.findElOrElsWithProcessing (/usr/local/lib/node_modules/appium/node_modules/@appium/base-driver/lib/basedriver/commands/find.ts:60:12)
at XCUITestDriver.findElementFromElement (/usr/local/lib/node_modules/appium/node_modules/@appium/base-driver/lib/basedriver/commands/find.ts:88:12)
[4b93d814][HTTP] <-- POST /session/4b93d814-cdfa-4da9-ba26-a5b1eb4fa2cf/element/1B000000-0000-0000-175C-010000000000/element 404 276 ms - 1028
I noticed limitXpathContextScope
is set to true
here:
[4b93d814][XCUITestDriver@497d] Got response with status 200: {"value":{"mjpegFixOrientation":false,"boundElementsByIndex":false,"mjpegServerFramerate":1,"maxTypingFrequency":60,"reduceMotion":true,"respectSystemAlerts":false,"elementResponseAttributes":"type,label","screenshotQuality":3,"mjpegScalingFactor":10,"screenshotOrientation":"auto","keyboardPrediction":0,"defaultActiveApplication":"auto","mjpegServerScreenshotQuality":1,"defaultAlertAction":"","keyboardAutocorrection":0,"useFirstMatch":false,"limitXpathContextScope":true,"shouldUseCompactResponses":true,"dismissAlertButtonSelector":"","activeAppDetectionPoint":"64.00,64.00","useClearTextShortcut":true,"snapshotMaxDepth":50,"waitForIdleTimeout":10,"includeNonModalElements":false,"acceptAlertButtonSelector":"","animationCoolOffTimeout":2},"sessionId":"3045F611-FC8E-42F7-AB33-9A95BBCFD385"}