【发布时间】:2012-02-03 16:14:14
【问题描述】:
我的应用中有一个搜索字段,我已将此字段的键盘返回键类型设置为UIReturnKeyNext。我正在尝试编写一个 UIAutomation 测试,使用以下行单击键盘上的 Next 按钮:
UIATarget.localTarget().frontMostApp().mainWindow().keyboard().keys().firstWithName("next");
此调用失败,因为未找到名为“next”的键。我已经使用以下方法转储了我的应用程序中的所有元素:
UIATarget.localTarget().frontMostApp().logElementTree();
这表明键盘中确实有一个名为“next”的键,但不知何故,我尝试如上所示检索它仍然失败。但是,我可以使用此方法检索其他键(例如字母“u”的键)。这里有已知问题还是我做错了什么?
我尝试了其他变体但没有运气:
UIATarget.localTarget().frontMostApp().mainWindow().keyboard().elements()["next"];
这是我的 UIAKeyboard 中元素的屏幕截图:
【问题讨论】:
标签: iphone ios instruments ui-automation ios-ui-automation