How can you see the XCUIElement tree?

Background:

I am experimenting with testing the ui level in iOS 9.0 with Xcode GM.

Question:

Is there a team in Xcode GM that allows you to see the "tree" of available elements and their relationships? Something like the 'page' command in Appium?

Ideally, I could run a command in the debugger that would provide me with a list of items available for selection / manipulation. You can currently use debugDescription on one XCUIElement, but this only gives you information for this element.

+11
source share
4 answers

, ... :

po print(XCUIApplication().debugDescription)

, XCUITesting. :

func testTreeExample() {
  XCUIApplication().buttons["login"].tap()
  print(XCUIApplication().debugDescription)
  XCUIApplication().buttons["next"].tap()
  print(XCUIApplication().debugDescription)
}

, -, , , - .

+13

, , Xcodes Accessibility Inspector , . (N.B. "" IB, "".):

Xcode 7.2 Xcode- > Open Developer Tool- > Accessibility Inspector. (, .) iOS Xcode SIMULATOR. , , ..

, , , , , , . ( , UISegmentedControl , , , .)

shinobicontrols.com !

+10

: Debug > View Debugging > Capture View Hierarchy debug. , . -- , . , .

+4
source

Appium does this with Facebook WebdriverAgent . As far as I can tell, how they do it, in fact, starts from the root element of the application and collects information about each child element, and then repeats.

0
source

Source: https://habr.com/ru/post/1609050/


All Articles