我正在尝试通过 iPhone 模拟器和最新的 iOS SDK 4.2 在 Instruments 中使用 UIAutomation。在我有 2 个未标记工具栏的应用程序中,我只能访问 head-toolbar,例如:
var window = UIATarget.localTarget().frontMostApp().mainWindow();
window.toolbar().buttons()["上传"].isVisible();
并且不能将 isVisible() 用于未标记工具栏中的按钮(取消、确定、转发)(在下面附上我的日志)
4) UIAToolbar [name:(null) value:(null) NSRect: {{0, 20}, {320, 44}}] 5) UIAButton [name:angle_bracket_left_i value:(null) NSRect: {{-3, 16 }, {50, 51}}] 5) UIAButton [name:angle_bracket_right_ value:(null) NSRect: {{27, 16}, {50, 51}}] 5) UIATextField [name:(null) value:http: //www.google.com.vn/ NSRect: {{72, 29}, {164, 26}}] 5) UIAButton [name:upload value:(null) NSRect: {{246, 29}, {34, 27}}] 5) UIAButton [name:Refresh value:(null) NSRect: {{285, 24}, {28, 33}}] 4) UIAToolbar [name:(null) value:(null) NSRect: {{ 0, 436}, {320, 44}}] 5) UIAButton [name:cancel value:(null) NSRect: {{1, 439}, {50, 40}}] 5) UIAButton [name:ok value:( null) NSRect: {{132, 430}, {50, 51}}] 5) UIAButton [name:forward value:(null) NSRect: {{263, 430}, {50, 51}}]