fix(android): parse uiautomator XML attributes with single or double quotes#37
Merged
Merged
Conversation
Contributor
Author
|
There appears to be a deployment issue. This is unrelated to the recent changes; how should we handle this? |
Member
|
Thank you! I've pushed a small refactor and xml parsing hardening for security |
Contributor
Author
|
This is my first time contributing to an open-source project, and it's been a great experience. Thank you for your and the community's positive response and helpful replies. |
Member
|
Love it, thanks for contributing! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Question
In the XML dump of Android uiautomator, node attributes may be enclosed in single or double quotes. Previous parsing logic only supported double quotes, causing parsing failures in single-quote scenarios, resulting in the inability to correctly retrieve key attributes such as
text,content-desc, andbounds.Solution
• A new readXmlAttr() function has been added, which supports both single and double quotes with the regular expression
/name=(["'])(.*?)\1/• Refactored findBounds and readNodeAttributes to use a unified new function for reading attributes.
• Export findBounds and parseUiHierarchy for testing.
test
Four new unit test coverages have been added:
Change documents
This commit should fix #25