Why is it the button in my view cant be seen by UIAutomation?
i am able to see the view but im unable to see/tap the button inside it. The button has a accessibility label of UIA_loginview_loginbutton with accesibility enabled. why is it not showing on logElementTree()?
var target = UIATarget.localTarget();
var application = target.frontMostApp();
var window = application.mainWindow();
var view = window.elements().firstWithName("UIA_loginview_view");
UIATarget.localTarget().logElementTree();
UIATarget.localTarget().frontMostApp().logElementTree();
if(view == null || view.toString() == "[object UIAElementNil]")
{
UIALogger.logFail("View not found - "+view.toString());
}
else
{
UIALogger.logPass("View found - "+view.toString());
UIALogger.logMessage("View开发者_如何转开发 Elements length - "+view.buttons().length);
view.buttons()["UIA_loginview_loginbutton"].tap();
}
Log Element Tree: //Shows my view but not the button inside it
4) UIAElement [name:UIA_loginview_view value:(null) NSRect: {{0, 20}, {320, 460}}]
Ensure that the accessability property of the button is not hidden by its container views. Only those elements, which should be accessable by the user should be marked as such. If you set a container view enabled "Accessability" in Interface Builder all subelements in the hierarchie will not be visible by UIAutomation.
Did that help?
精彩评论