Using the new UI Testing framework in xcode 7, has anyone figured out how to print all elements that are on the screen? The fact that there is little to none documentation on this whole new framework sure doesn't help.
UI Testing: Get element tree?
Yeah, I tried using that command, but it appears that's only for the Automation feature of Instruments. I'm looking for a way to do it in Xcode 7's new "Cocoa Touch UI Testing Bundle" target
The solution is to print out the debug description of whatever object you are working with. For example try:
let app = XCUIApplication()
print(app.debugDescription)
It is the replacement for logElementTree
The problem with .debugDescription
is that it doesn't properly format the output so it can be very hard to read.
You can use just use a breakpoint somewhere in your tests and do: po XCUIApplication()
and it will print the hierarchy in tree format, much easier to read