小编Ald*_*ich的帖子

为什么我的视图中的按钮不能被UIAutomation看到?

我能够看到视图,但我无法看到/点击其中的按钮.该按钮具有UIA_loginview_loginbutton的辅助功能标签,并且启用了辅助功能.为什么它没有显示在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();
}
Run Code Online (Sandbox Code Playgroud)

日志元素树://显示我的视图,但不显示其中的按钮

4)UIAElement [name:UIA_loginview_view value:(null)NSRect:{{0,20},{320,460}}]

iphone ios ios-ui-automation

5
推荐指数
1
解决办法
1946
查看次数

标签 统计

ios ×1

ios-ui-automation ×1

iphone ×1