forked from facebookarchive/WebDriverAgent
-
Notifications
You must be signed in to change notification settings - Fork 450
feat: Add new Appium setting for in-depth snapshot in JSON page source #997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
vinaykumar0339
wants to merge
1
commit into
appium:master
from
vinaykumar0339:support-indepth-flag-for-json-source-type
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how this is supposed to work. setting this argument to NO makes the snapshotting function to not return the
childrenproperty, which renders the recursive tree fetching impossibleThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mykola-mokhnach
The fb_takeSnapshot function allows passing inDepth: NO.
According to the official documentation, this method retrieves the entire hierarchy, including child elements.
I compared the results of passing YES and NO to inDepth, and both responses appear identical.
with YES parameter:


with No Parameter:
I also ran a diff check, and it showed no differences:

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps this trick only works for root/application elements. Let me test it locally.
Could you also provide performance comparison results?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mykola-mokhnach
Is time comparison metrics enough?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mykola-mokhnach
💡 Performance Summary:
With visible attribute (default):
inDepth=true: ~15s
inDepth=false: ~11s
With visible attribute excluded (appiumpageSourceExcludedAttributes: "visible"):
inDepth=true: ~3s (5× faster)
inDepth=false: ~0.5s (22× faster)
Yes, performance varies depending on the screen complexity. Using inDepth=false with excluded visible attributes can bring the page source API response time down to under 1 second in most cases.
The main motivation for this optimization in WebDriverAgent is to support a new library for the Appium ecosystem that will provide more generic element finding capabilities. This library will use element coordinate information (x,y bounds) to implement relative positioning strategies like "left of text", "right of text", "below", "above", etc.
We can make these spatial element-finding strategies much more efficient by improving the page source retrieval performance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say in case this snapshotting strategy really improves the performance then there is no point in putting it under a flag. Lets make it the default setting instead. @vinaykumar0339 Please check if #998 works for you
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mykola-mokhnach Yes, this change (#998) works for me as well since it uses:
May I ask when this change could be pushed along with Appium? (https://github.com/appium/appium-xcuitest-driver/)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Published in the xcuitest driver 9.1.3+
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mykola-mokhnach for the quick response and for considering my suggestion! Appreciate the effort in creating a new version based on it. 🚀