Skip to content

feat: make maxChildren configuable#1117

Merged
KazuCocoa merged 10 commits intomasterfrom
max-children
Mar 8, 2026
Merged

feat: make maxChildren configuable#1117
KazuCocoa merged 10 commits intomasterfrom
max-children

Conversation

@KazuCocoa
Copy link
Member

@KazuCocoa KazuCocoa commented Mar 6, 2026

maxChildren sets the maximum number of elements to retrieve in each snapshot. This could help to improve the element retrieval performance like maxDepth. This might be more for advanced users.

maxDepth is how deeply recursive the snapshot. maxChildren affects each snapshot. For example, if maxChildren was 1 and maxDepth was 2, the result will be two nested element tree but each element tree has only one element.

This is the home screen's page source when maxChildren is 1 and maxDepth is default (50).
Screenshot 2026-03-05 at 11 06 35 PM

This is the home screen's page source when maxDepth and maxChildren are default values.
Screenshot 2026-03-05 at 11 06 43 PM

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new session setting, snapshotMaxChildren, to let advanced users cap the number of child elements traversed per XCElementSnapshot request (similar in spirit to snapshotMaxDepth) to improve page source / snapshot performance in large hierarchies.

Changes:

  • Introduces a new settings key (snapshotMaxChildren) and exposes it via the existing /settings GET/SET routes.
  • Adds FBConfiguration accessors for snapshotMaxChildren and wires them into snapshot request parameters using the existing XCAXClient default-parameters override mechanism.
  • Adds a helper to remove a previously-set custom snapshot request parameter (used during session reset).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
WebDriverAgentLib/Utilities/FBSettings.m Adds the snapshotMaxChildren setting key constant.
WebDriverAgentLib/Utilities/FBSettings.h Exposes the snapshotMaxChildren setting key constant.
WebDriverAgentLib/Utilities/FBConfiguration.m Adds snapshotMaxChildren getters/setters and resets it for new sessions.
WebDriverAgentLib/Utilities/FBConfiguration.h Documents/exposes snapshotMaxChildren configuration APIs.
WebDriverAgentLib/Commands/FBSessionCommands.m Adds snapshotMaxChildren to /settings GET response and applies it on /settings SET.
WebDriverAgentLib/Categories/XCAXClient_iOS+FBSnapshotReqParams.m Adds maxChildren parameter key constant and implements removal of custom snapshot params.
WebDriverAgentLib/Categories/XCAXClient_iOS+FBSnapshotReqParams.h Exposes maxChildren key and the new remove helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@eglitise
Copy link

eglitise commented Mar 6, 2026

lib/types.ts probably also needs to be updated with this new setting

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@KazuCocoa KazuCocoa merged commit 57dd6dc into master Mar 8, 2026
50 of 51 checks passed
@KazuCocoa KazuCocoa deleted the max-children branch March 8, 2026 02:22
github-actions bot pushed a commit that referenced this pull request Mar 8, 2026
## [11.4.0](v11.3.0...v11.4.0) (2026-03-08)

### Features

* make maxChildren configuable ([#1117](#1117)) ([57dd6dc](57dd6dc))
@github-actions
Copy link

github-actions bot commented Mar 8, 2026

🎉 This PR is included in version 11.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants