Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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}}]

like image 552
Aldrich Avatar asked Jan 13 '11 07:01

Aldrich


1 Answers

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?

like image 171
Rene Berlin Avatar answered Oct 20 '22 19:10

Rene Berlin