Question

I have a structure in the mainWindow() of my application as follows:

enter image description here

Within the children directory of the UIAWindow near the top of the image, I am trying to access Item 1, where it is a UIAButton.

This structure is generated from

#import "tuneup/tuneup.js"

goAbout = function(target, app)
{
    UIATarget.localTarget().frontMostApp().mainWindow().logElementTree();

};

test("go about", goAbout);

If I add .button() or [1] it raises an exception, so I cannot do something like so

...
UIATarget.localTarget().frontMostApp().mainWindow().buttons().logElementTree();

What can I do to access the object within the children subdirectory of the UIAWindow?

Was it helpful?

Solution

You can access that button by adding .buttons()[0]. The

UIATarget.localTarget().frontMostApp().mainWindow().buttons();

expression returns a javascript array (which has a 0 based indexing).

Here you can find a rather usable documentation: https://developer.apple.com/library/ios/documentation/DeveloperTools/Reference/UIAutomationRef/UIAutomationRef.pdf

Anyway studying this plist is not the most convenient method to explore your object hierarchy. I prefer to check instruments output directy. (Or standard output, if you run instruments from command line.)

OTHER TIPS

That tree hierarchy ended up not meaning anything useful to me, and I ended up utilizing target methods to access the elements of my window. Cheers!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top