How to find the list of objects available on the page for IOS Automation?

Hi,

Normally, I would use the Appium Inspector to find the list of objects available on the page, and either get access to the object through “name” or “className”. However, Appium Inspector can only access the IOS Simulator, which Twitter app cannot be installed. My current app is interacting with the Twitter app, so I need to test the interaction. Since Twitter app cannot be installed in the IOS Simulator, I cannot go through a scenario that my app interact with a Twitter via IOS Simulator, thus I cannot find out the objects information from the Appium Inspector.

To work around, I am using random className such as UIAStaticText to grab the particular object that I want and I was successful for one or two objects, however, I cannot obtain all the objects on the page since I don’t know their className.

Is there a function that can list all the children objects by the parent? For example: since I know that UIAWindow clalssName is topmost, I would like something to be like this:

WebElement win = device().findElement(By.className(“UIAWindow”));
List (WebElement> children = win.getChildren(); //the syntax is wrong cuz i cannot put both open and close bracket.
System.out.println(children.get(0).getClassName);

  • getChildren() would return a list of all the children elements of the parent, UIAWindow. Please note: only the children (just one level), NOT the grandchildren, grand-grandchildren, and so on.

  • getClassName() would print out the className of that WebElement.

Appium Developer - if you know this feature existed, please provide the insight. If not, can we put in a request? This would help us greatly in traversing the GUI objects. Thank you!

I’m pretty sure the appium inspector works on physical devices as well. The ruby console has a page command which works on both real devices and simulators.

Thank you. I just configured appium inspector to work on the physical device.

inspector is the best way like bootstraponline said, but in console you can play with some methods, such as:

page_class

get_page_class

page :UIATextfield 
(or any present class)

_by_json({typeArray: ["UIATextField"], onlyFirst: false, onlyVisible: false}) 
(or any other class to show not visible elements)