开发者

iOS UIAutomation Scripting: What's the correct predicate to reference the keyboard?

开发者 https://www.devze.com 2023-01-15 17:33 出处:网络
Using UIATarget.localTarget().frontMostApp().logElementTree; when I know that there is a keyboard present (after tapping a text field) shows that there is a UIAKeyboard element in the hierarchy. How

Using

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

when I know that there is a keyboard present (after tapping a text field) shows that there is a UIAKeyboard element in the hierarchy. However, it does not have a name. I'd like to get a ref to that so that I can dismiss it from the script. My best guess is to use something like:

UIATarget.localTarget().frontMostApp().elements().firstWithPredicate("Class like UIAElement"开发者_如何学运维);

but I can't figure out the correct predicate string format. If you guys know a better way, please guide me.


See UIAApplication.keyboard():

Returns the UIAKeyboard object representing the application’s keyboard, if it exists.

Example I'm using to select 'Go':

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

0

精彩评论

暂无评论...
验证码 换一张
取 消