iOS UIAutomation Scripting:引用键盘的正确谓词是啥?

Posted

技术标签:

【中文标题】iOS UIAutomation Scripting:引用键盘的正确谓词是啥?【英文标题】:iOS UIAutomation Scripting: What's the correct predicate to reference the keyboard?iOS UIAutomation Scripting:引用键盘的正确谓词是什么? 【发布时间】:2010-09-13 09:13:12 【问题描述】:

使用

UIATarget.localTarget().frontMostApp().logElementTree;

当我知道存在键盘时(在点击文本字段后)表明层次结构中有一个 UIAKeyboard 元素。但是,它没有名字。我想获得一个参考,这样我就可以从脚本中将其解雇。 我最好的猜测是使用类似的东西:

UIATarget.localTarget().frontMostApp().elements().firstWithPredicate("Class like UIAElement");

但我无法找出正确的谓词字符串格式。如果你们知道更好的方法,请指导我。

【问题讨论】:

【参考方案1】:

参见 UIAApplication.keyboard():

返回表示应用程序键盘的 UIAKeyboard 对象(如果存在)。

我用来选择“Go”的示例:

var app = UIATarget.localTarget().frontMostApp(); app.keyboard().elements()["go"].tap();

【讨论】:

以上是关于iOS UIAutomation Scripting:引用键盘的正确谓词是啥?的主要内容,如果未能解决你的问题,请参考以下文章