appium: Setting driver.updateSettings({ snapshotMaxDepth: 60 }) doesn't have any effect
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
Setting a custom snapshotMaxDepth doesn’t work
The problem was discovered after upgrading the Appium XCUITestDriver driver from 4.12.2
to 4.12.3
. Setting a custom snapshotMaxDepth works with driver version 4.12.2
but doesn’t seem to have any affect with 4.12.3
or any of the versions above that.
From a quick check it seems the problem might have been introduced here:
https://github.com/appium/WebDriverAgent/pull/638
https://github.com/appium/WebDriverAgent/compare/v4.10.9...v4.10.10
Expected Behavior
Elements nested deeper than 50 levels in the DOM can still be found by increasing the snapshotMaxDepth.
Minimal Reproducible Example
Using Appium 2.0.0-beta.52
and xcuitest@4.12.3
- Find an element that could only be found by increasing the snapshotMaxDepth
- Set a custom snapshotMaxDepth by calling the Webdriverio Appium command
driver.updateSettings({ snapshotMaxDepth: 60 })
- Element can NOT be found
Using Appium 2.0.0-beta.52
and xcuitest@4.12.2
- Find an element that could only be found by increasing the snapshotMaxDepth
- Set a custom snapshotMaxDepth by calling the Webdriverio Appium command
driver.updateSettings({ snapshotMaxDepth: 60 })
- Element CAN be found
Environment
- appium version 2.0.0-beta.52
- xcuitest@4.12.3
- node version v19.1.0
- iOS simulator -> iOS 15.4 , iOS16.1, iOS 16.2
Link to Appium Logs
https://gist.github.com/razvan-avi/028664cff16dec6f880302401f40268b
Futher Information
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 36 (8 by maintainers)
@hdesai-dave the fix in question is related to element lookup by Xpath, the page source flow does not go through this route.
Previously locating elements nested in a depth of 54 was not possible when increasing the snapshot max depth, however it is possible after this change (in combination of setting the snapshot max depth to 60).
I’ve increased the tree depth of my test app to 60 and tried to use the page source command to retrieve the elements tree and was only successful after limiting the snapshot max depth specifically to 62. It seems that any value larger than 62 (at least in my test application) causes the snapshot retrieval to fail in the testmanagerd side with a
Too many nested arrays or dictionaries
CoreFoundation error. Unfortunately we have no influence of that limit (this error originates from CoreFoundation, meaning this limit is from the OS level), so it looks like 62 is the maximum value testmanagerd can handle.Depth must be below 63. 62 is max
@Dor-bl sure, just open a new issue with all the relevant logs
Yes, it probably means it is too deeply nested
@mykola-mokhnach, you cannot really set “session settings” in any session with
xcuitest 4.12.3
or above. The thing that changed from 4.12.2 to 4.12.3 is also upgradingappium-webdriveragent
to 4.10.10This new version contains some changes that explicitly touched the “session settings” https://github.com/appium/WebDriverAgent/pull/629 Could it be, now that we are resetting the session-specific settings on startup we are also interfering with actually setting them?
Some additional findings: Initializing a setting via capabilities doesn’t work
'appium:settings[snapshotMaxDepth]': 500
Using webdriverio command doesn’t work:
driver.updateSettings({ snapshotMaxDepth: 60 })
both options were working previously. Interestingly enough I can see the settings being set using
driver.getSettings()
they just don’t have any effect.Also using the Appium inspector I can still properly set the snapshotMaxDepth successfully, which allows me to identify +50 nested elements like so:
"appium:settings[snapshotMaxDepth]": "60",
Not sure if this helps in any way, just wanted to add some additional findings. Let me know if I can help out investigating this further. thanks!