# Element's snapshot depth

**URL:** <https://discuss.appium.io/t/elements-snapshot-depth/45587>\
**Category:** Feature\
**Created:** [March 12, 2025, 2:08pm UTC](https://discuss.appium.io/t/elements-snapshot-depth/45587 "2025-03-12T14:08:03Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![veno](https://discuss.appium.io/user_avatar/discuss.appium.io/veno/32/12972_2.png) [@veno](https://discuss.appium.io/u/veno)\
**Post date:** [March 12, 2025, 2:08pm UTC](https://discuss.appium.io/t/elements-snapshot-depth/45587/1 "2025-03-12T14:08:04Z")

</div>

My goal is to get minimum required snapshot depth for each test. To achieve this i try to get depth for each element used in the test. I tried accessing parents until they exist with:

```auto
let depth = 0;
let element = await client.$(selector);
while (element) {
    depth += 1;
    try {
        element = await element.$("..");
    } catch (_) {
        break;
    }
}

```

but it doesn’t work.  
Is there any other option besides getting source at each step and analyzing it?

Edit:  
I want it to work with every selector type (not just xpath).  
For `element.parentElement();` I get: `Method is not implemented`.

---

<div class="post-metadata">

**Author:** ![mykola-mokhnach](https://discuss.appium.io/user_avatar/discuss.appium.io/mykola-mokhnach/32/4578_2.png) [@mykola-mokhnach](https://discuss.appium.io/u/mykola-mokhnach)\
**Post date:** [March 12, 2025, 5:24pm UTC](https://discuss.appium.io/t/elements-snapshot-depth/45587/2 "2025-03-12T17:24:42Z")

</div>

I assume such possibilty would only exist for UIA2 driver with [limitXPathContextScope](https://github.com/appium/appium-uiautomator2-driver?tab=readme-ov-file#settings-api) setting set to `false`

---

<div class="post-metadata">

**Author:** ![veno](https://discuss.appium.io/user_avatar/discuss.appium.io/veno/32/12972_2.png) [@veno](https://discuss.appium.io/u/veno)\
**Post date:** [March 12, 2025, 5:48pm UTC](https://discuss.appium.io/t/elements-snapshot-depth/45587/3 "2025-03-12T17:48:13Z")

</div>

Thank you for your response. Sadly it still doesn’t work.  
My config is:

```auto
const client = await remote({
    path: "/",
    port: 4723,
    capabilities: {
        platformName: 'iOS', 
        'appium:deviceName': "...", 
        'appium:platformVersion': '15.8',
        'appium:automationName': 'XCUITest', 
        "appium:udid": "...",
        "appium:webDriverAgentUrl": "http://localhost:7700",
        "appium:settings": {
            "limitXPathContextScope": false,
        }
    },
});

```

My test:

```auto
const child = await client.$('//*[@name="Start"]');
console.log({ child });
const parent = await element.$("..");
console.log({ parent });

```

Child element exists and is nested. Parent element gets `NoSuchElementError`.

Edit:  
I also tried:

```auto
const parent = await element.$("./..");

```

---

<div class="post-metadata">

**Author:** ![mykola-mokhnach](https://discuss.appium.io/user_avatar/discuss.appium.io/mykola-mokhnach/32/4578_2.png) [@mykola-mokhnach](https://discuss.appium.io/u/mykola-mokhnach)\
**Post date:** [March 13, 2025, 3:38pm UTC](https://discuss.appium.io/t/elements-snapshot-depth/45587/4 "2025-03-13T15:38:23Z")

</div>

> [@mykola-mokhnach](#):
>
> such possibilty would only exist for UIA2 driver

> ```
> 'appium:automationName': 'XCUITest',
> 
> ```

¯\_(ツ)\_/¯

---

<div class="post-metadata">

**Author:** ![veno](https://discuss.appium.io/user_avatar/discuss.appium.io/veno/32/12972_2.png) [@veno](https://discuss.appium.io/u/veno)\
**Post date:** [March 14, 2025, 1:44pm UTC](https://discuss.appium.io/t/elements-snapshot-depth/45587/5 "2025-03-14T13:44:13Z")

</div>

Did not see that, my bad.  
Are there any alternative methods for determining depth on iOS, besides bisection, that are compatible with all types of selectors?

---

<div class="post-metadata">

**Author:** ![mykola-mokhnach](https://discuss.appium.io/user_avatar/discuss.appium.io/mykola-mokhnach/32/4578_2.png) [@mykola-mokhnach](https://discuss.appium.io/u/mykola-mokhnach)\
**Post date:** [March 20, 2025, 10:56pm UTC](https://discuss.appium.io/t/elements-snapshot-depth/45587/6 "2025-03-20T22:56:46Z")

</div>

I’ve this feature to XCUITest driver under the `limitXPathContextScope` setting. See [chore: Bump WDA by mykola-mokhnach · Pull Request #2535 · appium/appium-xcuitest-driver · GitHub](https://github.com/appium/appium-xcuitest-driver/pull/2535/) for more details

---

<div class="post-metadata">

**Author:** ![veno](https://discuss.appium.io/user_avatar/discuss.appium.io/veno/32/12972_2.png) [@veno](https://discuss.appium.io/u/veno)\
**Post date:** [March 21, 2025, 7:10pm UTC](https://discuss.appium.io/t/elements-snapshot-depth/45587/7 "2025-03-21T19:10:23Z")

</div>

After updating the driver the problem remains the same.

```auto
appium version:
ap2.17.1
appium driver list:
- xcuitest@8.4.3 [installed (npm)]

```

I ran the same test as mentioned above.

---

<div class="post-metadata">

**Author:** ![mykola-mokhnach](https://discuss.appium.io/user_avatar/discuss.appium.io/mykola-mokhnach/32/4578_2.png) [@mykola-mokhnach](https://discuss.appium.io/u/mykola-mokhnach)\
**Post date:** [March 21, 2025, 10:58pm UTC](https://discuss.appium.io/t/elements-snapshot-depth/45587/8 "2025-03-21T22:58:01Z")

</div>

Please provide the full server log

---

<div class="post-metadata">

**Author:** ![veno](https://discuss.appium.io/user_avatar/discuss.appium.io/veno/32/12972_2.png) [@veno](https://discuss.appium.io/u/veno)\
**Post date:** [March 22, 2025, 10:07am UTC](https://discuss.appium.io/t/elements-snapshot-depth/45587/9 "2025-03-22T10:07:34Z")

</div>

Code:

```js
const client = await remote({
    path: "/",
    port: 4723,
    capabilities: {
        platformName: 'iOS', 
        'appium:deviceName': "...", 
        'appium:platformVersion': '18.1.1',
        'appium:automationName': 'XCUITest', 
        "appium:udid": "...",
        "appium:webDriverAgentUrl": "http://localhost:7700",
        "appium:settings": {
            "limitXPathContextScope": false
        }
    },
});

const element = await client.$('//XCUIElementTypeButton[@name="Start"]');
const parent = await element.$("./..");
console.log(parent);

```

Server output:

```auto
[Appium] Welcome to Appium v2.17.1
[Appium] The autodetected Appium home path: /Users/.../.appium
[Appium] Attempting to load driver xcuitest...
[Appium] Attempting to load driver uiautomator2...
[Appium] Requiring driver at /Users/.../.appium/node_modules/appium-xcuitest-driver/build/index.js
[Appium] Requiring driver at /Users/.../.appium/node_modules/appium-uiautomator2-driver/build/index.js
[Appium] XCUITestDriver has been successfully loaded in 0.448s
[Appium] AndroidUiautomator2Driver has been successfully loaded in 0.915s
[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] - xcuitest@8.4.3 (automationName 'XCUITest')
[Appium] - uiautomator2@3.9.7 (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@2d0b] 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/.../.appium/node_modules/appium-xcuitest-driver
[Appium] Requiring driver at /Users/.../.appium/node_modules/appium-xcuitest-driver/build/index.js
[AppiumDriver@2d0b] Appium v2.17.1 creating new XCUITestDriver (v8.4.3) session
[AppiumDriver@2d0b] Checking BaseDriver versions for Appium and XCUITestDriver
[AppiumDriver@2d0b] Appium's BaseDriver version is 9.16.4
[AppiumDriver@2d0b] XCUITestDriver's BaseDriver version is 9.16.4
[XCUITestDriver@21d3] 
[XCUITestDriver@21d3] 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@21d3] The desired capabilities include neither an app nor a bundleId. WebDriverAgent will be started without the default app
[5d8e6af9][XCUITestDriver@21d3] Session created with session id: 5d8e6af9-42e1-411b-935e-7cda1791959c
[5d8e6af9][XCUITest] Current user: '...'
[5d8e6af9][XCUITestDriver@21d3] Skipping checking of the real devices availability since the session specifies appium:webDriverAgentUrl
[5d8e6af9][XCUITestDriver@21d3] Creating iDevice object with udid '...'
[5d8e6af9][XCUITestDriver@21d3] Determining device to run tests on: udid: '...', real device: true
[5d8e6af9][XCUITestDriver@21d3] Reset: running ios real device reset flow
[5d8e6af9][XCUITestDriver@21d3] Using WDA path: '/Users/.../.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent'
[5d8e6af9][XCUITestDriver@21d3] Using WDA agent: '/Users/.../.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj'
[5d8e6af9][XCUITestDriver@21d3] The pyidevice tool is not present in PATH. Skipping crash logs collection for real devices.
[5d8e6af9][XCUITestDriver@21d3] Setting up real device
[5d8e6af9][DevCon Factory] Requesting connection for device ... on local port 7700
[5d8e6af9][DevCon Factory] Cached connections count: 0
[5d8e6af9][DevCon Factory] Successfully requested the connection for ...:7700
[5d8e6af9][XCUITestDriver@21d3] Starting WebDriverAgent initialization with the synchronization key 'XCUITestDriver'
[5d8e6af9][XCUITestDriver@21d3] Trying to start WebDriverAgent once since at least one of webDriverAgentUrl,usePreinstalledWDA capabilities is provided
[5d8e6af9][XCUITestDriver@21d3] Using provided WebdriverAgent at 'http://localhost:7700'
[5d8e6af9][XCUITestDriver@21d3] JWProxy options: {"server":"localhost","port":7700,"base":"","timeout":240000,"keepAlive":true,"scheme":"http","reqBasePath":"","sessionId":null}
[5d8e6af9][XCUITestDriver@21d3] NoSessionProxy options: {"server":"localhost","port":7700,"base":"","timeout":240000,"keepAlive":true,"scheme":"http","reqBasePath":"","sessionId":null}
[5d8e6af9][WD Proxy] NoSessionProxy options: {"server":"localhost","port":"7700","base":"","timeout":3000,"scheme":"http","reqBasePath":"","sessionId":null}
[5d8e6af9][WD Proxy] Matched '/status' to command name 'getStatus'
[5d8e6af9][WD Proxy] Proxying [GET /status] to [GET http://localhost:7700/status] with no body
[5d8e6af9][WD Proxy] Got response with status 200: {"value":{"build":{"version":"8.11.1","time":"Dec 3 2024 14:54:08","productBundleIdentifier":"com.facebook.WebDriverAgentRunner"},"os":{"testmanagerdVersion":65535,"name":"iOS","sdkVersion":"18.0","version":"18.1.1"},"device":"iphone","ios":{"ip":"192.168.1.101"},"message":"WebDriverAgent is ready to accept commands","state":"success","ready":true},"sessionId":"F37AA69C-75A3-4C3D-86F9-408F047982A4"}
[5d8e6af9][XCUITestDriver@21d3] Sending createSession command to WDA
[5d8e6af9][XCUITestDriver@21d3] Matched '/session' to command name 'createSession'
[5d8e6af9][XCUITestDriver@21d3] 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":{}}}
[5d8e6af9][XCUITestDriver@21d3] Got response with status 200: {"value":{"sessionId":"E541AB19-5AA0-419E-9AC0-D76349269706","capabilities":{"sdkVersion":"18.1.1","device":"iphone"}},"sessionId":"E541AB19-5AA0-419E-9AC0-D76349269706"}
[5d8e6af9][XCUITestDriver@21d3] Determined the downstream protocol as 'W3C'
[5d8e6af9][XCUITestDriver@21d3] WDA session startup took 7ms
[5d8e6af9][BaseDriver] The value of 'elementResponseAttributes' setting did not change. Skipping the update for it
[5d8e6af9][BaseDriver] The value of 'shouldUseCompactResponses' setting did not change. Skipping the update for it
[5d8e6af9][XCUITestDriver@21d3] Forwarding MJPEG server port 9100 to local port 9100
[5d8e6af9][DevCon Factory] Requesting connection for device ... on local port 9100, device port 9100
[5d8e6af9][DevCon Factory] Cached connections count: 1
[5d8e6af9][DevCon Factory] Successfully requested the connection for ...:9100
[5d8e6af9][AppiumDriver@2d0b] New XCUITestDriver session created successfully, session 5d8e6af9-42e1-411b-935e-7cda1791959c added to master session list
[5d8e6af9][AppiumDriver@2d0b] Applying the initial values to Appium settings parsed from W3C caps: {"limitXPathContextScope":false}
[5d8e6af9][XCUITestDriver@21d3] Matched '/appium/settings' to command name 'updateSettings'
[5d8e6af9][XCUITestDriver@21d3] Proxying [POST /appium/settings] to [POST http://localhost:7700/session/E541AB19-5AA0-419E-9AC0-D76349269706/appium/settings] with body: {"settings":{"limitXPathContextScope":false}}
[5d8e6af9][XCUITestDriver@21d3] 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,"shouldUseCompactResponses":true,"customSnapshotTimeout":15,"dismissAlertButtonSelector":"","activeAppDetectionPoint":"64.00,64.00","useClearTextShortcut":true,"snapshotMaxDepth":50,"waitForIdleTimeout":10,"includeNonModalElements":false,"acceptAlertButtonSelector":"","animationCoolOffTimeout":2},"sessionId":"E541AB19-5AA0-419E-9AC0-D76349269706"}
[5d8e6af9][XCUITestDriver@21d3] Cached the protocol value 'W3C' for the new session 5d8e6af9-42e1-411b-935e-7cda1791959c
[5d8e6af9][XCUITestDriver@21d3] 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.1","automationName":"XCUITest","udid":"...","webDriverAgentUrl":"http://localhost:7700"}}
[5d8e6af9][HTTP] <-- POST /session 200 535 ms - 447 
[5d8e6af9][HTTP] --> POST /session/5d8e6af9-42e1-411b-935e-7cda1791959c/element {"using":"xpath","value":"//XCUIElementTypeButton[@name=\"Start\"]"}
[5d8e6af9][XCUITestDriver@21d3] Calling AppiumDriver.findElement() with args: ["xpath","//XCUIElementTypeButton[@name=\"Start\"]","5d8e6af9-42e1-411b-935e-7cda1791959c"]
[5d8e6af9][XCUITestDriver@21d3] Executing command 'findElement'
[5d8e6af9][XCUITestDriver@21d3] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id, css selector
[5d8e6af9][XCUITestDriver@21d3] Waiting up to 0 ms for condition
[5d8e6af9][XCUITestDriver@21d3] Matched '/element' to command name 'findElement'
[5d8e6af9][XCUITestDriver@21d3] Proxying [POST /element] to [POST http://localhost:7700/session/E541AB19-5AA0-419E-9AC0-D76349269706/element] with body: {"using":"xpath","value":"//XCUIElementTypeButton[@name=\"Start\"]"}
[5d8e6af9][XCUITestDriver@21d3] Got response with status 200: {"value":{"ELEMENT":"10000000-0000-0000-E787-000000000000","element-6066-11e4-a52e-4f735466cecf":"10000000-0000-0000-E787-000000000000"},"sessionId":"E541AB19-5AA0-419E-9AC0-D76349269706"}
[5d8e6af9][XCUITestDriver@21d3] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"10000000-0000-0000-E787-000000000000","ELEMENT":"10000000-0000-0000-E787-000000000000"}
[5d8e6af9][HTTP] <-- POST /session/5d8e6af9-42e1-411b-935e-7cda1791959c/element 200 454 ms - 137 
[5d8e6af9][HTTP] --> POST /session/5d8e6af9-42e1-411b-935e-7cda1791959c/element/10000000-0000-0000-E787-000000000000/element {"using":"xpath","value":"./.."}
[5d8e6af9][XCUITestDriver@21d3] Calling AppiumDriver.findElementFromElement() with args: ["xpath","./..","10000000-0000-0000-E787-000000000000","5d8e6af9-42e1-411b-935e-7cda1791959c"]
[5d8e6af9][XCUITestDriver@21d3] Executing command 'findElementFromElement'
[5d8e6af9][XCUITestDriver@21d3] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id, css selector
[5d8e6af9][XCUITestDriver@21d3] Waiting up to 0 ms for condition
[5d8e6af9][XCUITestDriver@21d3] Matched '/element/10000000-0000-0000-E787-000000000000/element' to command name 'findElementFromElement'
[5d8e6af9][XCUITestDriver@21d3] Proxying [POST /element/10000000-0000-0000-E787-000000000000/element] to [POST http://localhost:7700/session/E541AB19-5AA0-419E-9AC0-D76349269706/element/10000000-0000-0000-E787-000000000000/element] with body: {"using":"xpath","value":"./.."}
[5d8e6af9][XCUITestDriver@21d3] 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 0x00000001080bf044 +[FBXPath xmlStringWithRootElement:options:] + 0\n\t3 WebDriverAgentLib 0x00000001080bf7f4 +[FBXPath matchesWithRootElement:forQuery:] + 772\n\t4 WebDriverAgentLib 0x00000001080d9aac -[XCUIElement(FBFind) fb_descendantsMatchingXPathQuery:shouldReturnAfterFirstMatch:] + 152\n\t5 WebDriverAgentLib 0x000000010811ae00 +[FBFindElementCommands elementsUsing:withValue:under:shouldReturnAfterFirstMatch:] + 756\n\t6 WebDriverAgentLib 0x000000010811aaac +[FBFindElementCommands elementUsing:withValue:under:] + 132\n\t7 WebDriverAgentLib 0x000000010811a5...
[5d8e6af9][W3C] Matched W3C error code 'unknown error' to UnknownError
[5d8e6af9][XCUITestDriver@21d3] Encountered internal error running command: NoSuchElementError: An element could not be located on the page using the given search parameters.
    at XCUITestDriver.doNativeFind (/Users/.../.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/.../.appium/node_modules/appium-xcuitest-driver/lib/commands/find.js:97:12)
    at XCUITestDriver.findElOrEls (/Users/.../.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)
[5d8e6af9][HTTP] <-- POST /session/5d8e6af9-42e1-411b-935e-7cda1791959c/element/10000000-0000-0000-E787-000000000000/element 404 137 ms - 1028 

```

---

<div class="post-metadata">

**Author:** ![mykola-mokhnach](https://discuss.appium.io/user_avatar/discuss.appium.io/mykola-mokhnach/32/4578_2.png) [@mykola-mokhnach](https://discuss.appium.io/u/mykola-mokhnach)\
**Post date:** [March 23, 2025, 10:07pm UTC](https://discuss.appium.io/t/elements-snapshot-depth/45587/10 "2025-03-23T22:07:44Z")

</div>

> [@veno](#):
>
> ```auto
> "appium:settings": {
> "limitXPathContextScope": false
> }
> 
> ```

Please provide me a link to the doc where this method of providing driver setting is documented

---

<div class="post-metadata">

**Author:** ![veno](https://discuss.appium.io/user_avatar/discuss.appium.io/veno/32/12972_2.png) [@veno](https://discuss.appium.io/u/veno)\
**Post date:** [March 24, 2025, 5:05pm UTC](https://discuss.appium.io/t/elements-snapshot-depth/45587/11 "2025-03-24T17:05:57Z")

</div>

I found it here:

> <https://github.com/appium/appium-xcuitest-driver/blob/master/docs/reference/settings.md>

---

<div class="post-metadata">

**Author:** ![mykola-mokhnach](https://discuss.appium.io/user_avatar/discuss.appium.io/mykola-mokhnach/32/4578_2.png) [@mykola-mokhnach](https://discuss.appium.io/u/mykola-mokhnach)\
**Post date:** [March 24, 2025, 9:25pm UTC](https://discuss.appium.io/t/elements-snapshot-depth/45587/12 "2025-03-24T21:25:29Z")

</div>

> [5d8e6af9][WD Proxy] Got response with status 200: {“value”:{“build”:{“version”:“8.11.1”,“time”:“Dec 3 2024 14:54:08”,“productBundleIdentifier”:“com.facebook.WebDriverAgentRunner”},“os”:{“testmanagerdVersion”:65535,“name”:“iOS”,“sdkVersion”:“18.0”,“version”:“18.1.1”},“device”:“iphone”,“ios”:{“ip”:“192.168.1.101”},“message”:“WebDriverAgent is ready to accept commands”,“state”:“success”,“ready”:true},“sessionId”:“F37AA69C-75A3-4C3D-86F9-408F047982A4”}

It looks that the used WDA version is out of date (probably because of caching). Make sure the most recent one is used (9.3.0)

---

<div class="post-metadata">

**Author:** ![veno](https://discuss.appium.io/user_avatar/discuss.appium.io/veno/32/12972_2.png) [@veno](https://discuss.appium.io/u/veno)\
**Post date:** [March 26, 2025, 6:42pm UTC](https://discuss.appium.io/t/elements-snapshot-depth/45587/13 "2025-03-26T18:42:09Z")

</div>

I updated WDA to 9.3.1 but it still doesn’t work. This is the server output:

```auto
(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] - xcuitest@9.0.0 (automationName 'XCUITest')
[Appium] - uiautomator2@3.9.7 (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:

```auto
[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"}

```

---

<div class="post-metadata">

**Author:** ![mykola-mokhnach](https://discuss.appium.io/user_avatar/discuss.appium.io/mykola-mokhnach/32/4578_2.png) [@mykola-mokhnach](https://discuss.appium.io/u/mykola-mokhnach)\
**Post date:** [March 26, 2025, 9:42pm UTC](https://discuss.appium.io/t/elements-snapshot-depth/45587/14 "2025-03-26T21:42:10Z")

</div>

There was a typo in the setting name on WDA side (limitXpathContextScope != limitXPathContextScope)  
It has been fixed in the xcuitest driver 9.0.1-\>WDA 9.3.2

---

<div class="post-metadata">

**Author:** ![veno](https://discuss.appium.io/user_avatar/discuss.appium.io/veno/32/12972_2.png) [@veno](https://discuss.appium.io/u/veno)\
**Post date:** [March 26, 2025, 10:15pm UTC](https://discuss.appium.io/t/elements-snapshot-depth/45587/15 "2025-03-26T22:15:49Z")

</div>

`limitXpathContextScope` is now set to `false` in the settings, but parent element is still not found.  
Server output:

```auto
[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.460s
[Appium] XCUITestDriver has been successfully loaded in 0.918s
[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] - xcuitest@9.0.0 (automationName 'XCUITest')
[Appium] - uiautomator2@3.9.7 (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@0314] 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@0314] Appium v2.17.1 creating new XCUITestDriver (v9.0.0) session
[AppiumDriver@0314] Checking BaseDriver versions for Appium and XCUITestDriver
[AppiumDriver@0314] Appium's BaseDriver version is 9.16.4
[AppiumDriver@0314] XCUITestDriver's BaseDriver version is 9.16.4
[XCUITestDriver@789b] 
[XCUITestDriver@789b] 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@789b] The desired capabilities include neither an app nor a bundleId. WebDriverAgent will be started without the default app
[19656a3c][XCUITestDriver@789b] Session created with session id: 19656a3c-576a-42d8-b48e-0a0f5436c46f
[19656a3c][XCUITest] Current user: 'user'
[19656a3c][XCUITestDriver@789b] Skipping checking of the real devices availability since the session specifies appium:webDriverAgentUrl
[19656a3c][XCUITestDriver@789b] Creating iDevice object with udid '...'
[19656a3c][XCUITestDriver@789b] Determining device to run tests on: udid: '...', real device: true
[19656a3c][XCUITestDriver@789b] Normalized platformVersion capability value '18.1.1' to '18.1'
[19656a3c][XCUITestDriver@789b] Reset: running ios real device reset flow
[19656a3c][XCUITestDriver@789b] Using WDA path: '/Users/user/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent'
[19656a3c][XCUITestDriver@789b] Using WDA agent: '/Users/user/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj'
[19656a3c][XCUITestDriver@789b] The pyidevice tool is not present in PATH. Skipping crash logs collection for real devices.
[19656a3c][XCUITestDriver@789b] Setting up real device
[19656a3c][DevCon Factory] Requesting connection for device ... on local port 7700
[19656a3c][DevCon Factory] Cached connections count: 0
[19656a3c][DevCon Factory] Successfully requested the connection for ...:7700
[19656a3c][XCUITestDriver@789b] Starting WebDriverAgent initialization with the synchronization key 'XCUITestDriver'
[19656a3c][XCUITestDriver@789b] Trying to start WebDriverAgent once since at least one of webDriverAgentUrl,usePreinstalledWDA capabilities is provided
[19656a3c][XCUITestDriver@789b] Using provided WebdriverAgent at 'http://localhost:7700'
[19656a3c][XCUITestDriver@789b] JWProxy options: {"server":"localhost","port":7700,"base":"","timeout":240000,"keepAlive":true,"scheme":"http","reqBasePath":"","sessionId":null}
[19656a3c][XCUITestDriver@789b] NoSessionProxy options: {"server":"localhost","port":7700,"base":"","timeout":240000,"keepAlive":true,"scheme":"http","reqBasePath":"","sessionId":null}
[19656a3c][WD Proxy] NoSessionProxy options: {"server":"localhost","port":"7700","base":"","timeout":3000,"scheme":"http","reqBasePath":"","sessionId":null}
[19656a3c][WD Proxy] Matched '/status' to command name 'getStatus'
[19656a3c][WD Proxy] Proxying [GET /status] to [GET http://localhost:7700/status] with no body
[19656a3c][WD Proxy] Got response with status 200: {"value":{"build":{"version":"9.3.2","time":"Mar 26 2025 23:05:57","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":"B3C0C736-8C12-4953-B94C-34D91630D7F6"}
[19656a3c][XCUITestDriver@789b] Sending createSession command to WDA
[19656a3c][XCUITestDriver@789b] Matched '/session' to command name 'createSession'
[19656a3c][XCUITestDriver@789b] 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":{}}}
[19656a3c][XCUITestDriver@789b] Got response with status 200: {"value":{"sessionId":"E5A16B1B-18D2-432D-910C-2FA06F0FD53B","capabilities":{"sdkVersion":"18.1.1","device":"iphone"}},"sessionId":"E5A16B1B-18D2-432D-910C-2FA06F0FD53B"}
[19656a3c][XCUITestDriver@789b] Determined the downstream protocol as 'W3C'
[19656a3c][XCUITestDriver@789b] WDA session startup took 10ms
[19656a3c][BaseDriver] The value of 'elementResponseAttributes' setting did not change. Skipping the update for it
[19656a3c][BaseDriver] The value of 'shouldUseCompactResponses' setting did not change. Skipping the update for it
[19656a3c][XCUITestDriver@789b] Forwarding MJPEG server port 9100 to local port 9100
[19656a3c][DevCon Factory] Requesting connection for device ... on local port 9100, device port 9100
[19656a3c][DevCon Factory] Cached connections count: 1
[19656a3c][DevCon Factory] Successfully requested the connection for ...:9100
[19656a3c][AppiumDriver@0314] New XCUITestDriver session created successfully, session 19656a3c-576a-42d8-b48e-0a0f5436c46f added to master session list
[19656a3c][AppiumDriver@0314] Applying the initial values to Appium settings parsed from W3C caps: {"limitXPathContextScope":false}
[19656a3c][XCUITestDriver@789b] Matched '/appium/settings' to command name 'updateSettings'
[19656a3c][XCUITestDriver@789b] Proxying [POST /appium/settings] to [POST http://localhost:7700/session/E5A16B1B-18D2-432D-910C-2FA06F0FD53B/appium/settings] with body: {"settings":{"limitXPathContextScope":false}}
[19656a3c][XCUITestDriver@789b] Got response with status 200: {"value":{"mjpegFixOrientation":false,"boundElementsByIndex":false,"mjpegServerFramerate":40,"maxTypingFrequency":60,"reduceMotion":true,"respectSystemAlerts":false,"elementResponseAttributes":"type,label","screenshotQuality":3,"mjpegScalingFactor":40,"screenshotOrientation":"auto","keyboardPrediction":0,"defaultActiveApplication":"auto","mjpegServerScreenshotQuality":1,"limitXPathContextScope":false,"defaultAlertAction":"","keyboardAutocorrection":0,"useFirstMatch":false,"shouldUseCompactResponses":true,"dismissAlertButtonSelector":"","activeAppDetectionPoint":"64.00,64.00","useClearTextShortcut":true,"snapshotMaxDepth":50,"waitForIdleTimeout":10,"includeNonModalElements":false,"acceptAlertButtonSelector":"","animationCoolOffTimeout":2},"sessionId":"E5A16B1B-18D2-432D-910C-2FA06F0FD53B"}
[19656a3c][XCUITestDriver@789b] Cached the protocol value 'W3C' for the new session 19656a3c-576a-42d8-b48e-0a0f5436c46f
[19656a3c][XCUITestDriver@789b] 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"}}
[19656a3c][HTTP] <-- POST /session 200 544 ms - 447 
[19656a3c][HTTP] --> POST /session/19656a3c-576a-42d8-b48e-0a0f5436c46f/element {"using":"xpath","value":"//XCUIElementTypeButton[@name=\"Start\"]"}
[19656a3c][XCUITestDriver@789b] Calling AppiumDriver.findElement() with args: ["xpath","//XCUIElementTypeButton[@name=\"Start\"]","19656a3c-576a-42d8-b48e-0a0f5436c46f"]
[19656a3c][XCUITestDriver@789b] Executing command 'findElement'
[19656a3c][XCUITestDriver@789b] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id, css selector
[19656a3c][XCUITestDriver@789b] Waiting up to 0 ms for condition
[19656a3c][XCUITestDriver@789b] Matched '/element' to command name 'findElement'
[19656a3c][XCUITestDriver@789b] Proxying [POST /element] to [POST http://localhost:7700/session/E5A16B1B-18D2-432D-910C-2FA06F0FD53B/element] with body: {"using":"xpath","value":"//XCUIElementTypeButton[@name=\"Start\"]"}
[19656a3c][XCUITestDriver@789b] Got response with status 200: {"value":{"ELEMENT":"17000000-0000-0000-C265-010000000000","element-6066-11e4-a52e-4f735466cecf":"17000000-0000-0000-C265-010000000000"},"sessionId":"E5A16B1B-18D2-432D-910C-2FA06F0FD53B"}
[19656a3c][XCUITestDriver@789b] Responding to client with driver.findElement() result: {"element-6066-11e4-a52e-4f735466cecf":"17000000-0000-0000-C265-010000000000","ELEMENT":"17000000-0000-0000-C265-010000000000"}
[19656a3c][HTTP] <-- POST /session/19656a3c-576a-42d8-b48e-0a0f5436c46f/element 200 572 ms - 137 
[19656a3c][HTTP] --> POST /session/19656a3c-576a-42d8-b48e-0a0f5436c46f/element/17000000-0000-0000-C265-010000000000/element {"using":"xpath","value":"./.."}
[19656a3c][XCUITestDriver@789b] Calling AppiumDriver.findElementFromElement() with args: ["xpath","./..","17000000-0000-0000-C265-010000000000","19656a3c-576a-42d8-b48e-0a0f5436c46f"]
[19656a3c][XCUITestDriver@789b] Executing command 'findElementFromElement'
[19656a3c][XCUITestDriver@789b] Valid locator strategies for this request: xpath, id, name, class name, -ios predicate string, -ios class chain, accessibility id, css selector
[19656a3c][XCUITestDriver@789b] Waiting up to 0 ms for condition
[19656a3c][XCUITestDriver@789b] Matched '/element/17000000-0000-0000-C265-010000000000/element' to command name 'findElementFromElement'
[19656a3c][XCUITestDriver@789b] Proxying [POST /element/17000000-0000-0000-C265-010000000000/element] to [POST http://localhost:7700/session/E5A16B1B-18D2-432D-910C-2FA06F0FD53B/element/17000000-0000-0000-C265-010000000000/element] with body: {"using":"xpath","value":"./.."}
[19656a3c][XCUITestDriver@789b] Got response with status 404: {"value":{"error":"no such element","message":"unable to find an element using 'xpath', value './..'","traceback":"(\n\t0 WebDriverAgentLib 0x00000001011f4bac FBNoSuchElementErrorResponseForRequest + 252\n\t1 WebDriverAgentLib 0x00000001011f5330 +[FBFindElementCommands handleFindSubElement:] + 432\n\t2 WebDriverAgentLib 0x00000001011b72b0 -[FBRoute_TargetAction mountRequest:intoResponse:] + 168\n\t3 WebDriverAgentLib 0x00000001011a0fc8 __37-[FBWebServer registerRouteHandlers:]_block_invoke + 408\n\t4 WebDriverAgentLib 0x00000001011da134 -[RoutingHTTPServer handleRoute:withRequest:response:] + 168\n\t5 WebDriverAgentLib 0x00000001011dac24__72-[RoutingHTTPServer routeMethod:withPath:parameters:request:connection:]_block_invoke + 64\n\t6 libdispatch.dylib 0x00000001979b60d0 7DE7EC03-CFB7-349D-9B9E-8782B38F231D + 16592\n\t7 libdispatch.dylib 0x00000001...
[19656a3c][W3C] Matched W3C error code 'no such element' to NoSuchElementError
[19656a3c][XCUITestDriver@789b] 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)
[19656a3c][HTTP] <-- POST /session/19656a3c-576a-42d8-b48e-0a0f5436c46f/element/17000000-0000-0000-C265-010000000000/element 404 532 ms - 1028 

```

---

<div class="post-metadata">

**Author:** ![mykola-mokhnach](https://discuss.appium.io/user_avatar/discuss.appium.io/mykola-mokhnach/32/4578_2.png) [@mykola-mokhnach](https://discuss.appium.io/u/mykola-mokhnach)\
**Post date:** [March 27, 2025, 8:05am UTC](https://discuss.appium.io/t/elements-snapshot-depth/45587/16 "2025-03-27T08:05:53Z")

</div>

I hope [fix: Properly set snapshot lookup scope if limitXpathContextScope is disabled by mykola-mokhnach · Pull Request #996 · appium/WebDriverAgent · GitHub](https://github.com/appium/WebDriverAgent/pull/996/) should do the trick

---

<div class="post-metadata">

**Author:** ![veno](https://discuss.appium.io/user_avatar/discuss.appium.io/veno/32/12972_2.png) [@veno](https://discuss.appium.io/u/veno)\
**Post date:** [March 27, 2025, 12:02pm UTC](https://discuss.appium.io/t/elements-snapshot-depth/45587/17 "2025-03-27T12:02:44Z")

</div>

Can confirm it’s working now. Thank you again for your help.
