How to parse the string content of debugDescription in XCUITest swift

93 views Asked by At

As debugDescription returns the XCUIElement UI Tree and this if of type String. Want to fetch specific information based upon parameters like label :[String] will return all the label values, find_Application - will return the bundleID etc

1

There are 1 answers

0
Prakash Saravanan On

You can use element.snapshot().dictionaryRepresentation which gives a parsed version of output of element.debugDescription or element.snapshotDescription.

You can use element.snapshot().children to get the child element's snapshots iteratively if you want to create your own parser.