Ios 如何在Xcode中访问mainWindow的子窗口以实现UI自动化

Ios 如何在Xcode中访问mainWindow的子窗口以实现UI自动化,ios,ui-automation,ios-ui-automation,Ios,Ui Automation,Ios Ui Automation,我的应用程序主窗口中的结构如下: 在图像顶部附近的UIAWindow的children目录中,我试图访问条目1,其中是UIAButton 此结构是由 #import "tuneup/tuneup.js" goAbout = function(target, app) { UIATarget.localTarget().frontMostApp().mainWindow().logElementTree(); }; test("go about", goAbout); 如果我添加.

我的应用程序主窗口中的结构如下:

在图像顶部附近的UIAWindow的children目录中,我试图访问条目1,其中是UIAButton

此结构是由

#import "tuneup/tuneup.js"

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

};

test("go about", goAbout);
如果我添加.button或[1],它会引发一个异常,所以我不能这样做

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

如何访问UIAWindow的子目录中的对象

树层次结构最终对我没有任何意义,我最终使用目标方法访问窗口的元素。干杯

您可以通过添加.按钮[0]来访问该按钮。

表达式返回一个javascript数组,该数组具有基于0的索引

在这里,您可以找到一个相当有用的文档:

无论如何,研究这个plist并不是探索对象层次结构的最方便的方法。我更喜欢直接检查仪器的输出。或标准输出,如果从命令行运行仪器

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