Trouble Getting Elements by Name from UIAElementArray in UIAutomation

若如初见. 提交于 2019-12-04 18:57:06
edavidfs

If you are working with the accessibility Layer, you must to enable it in the Device/Simulator:

Settings-> General-> Accessibility-> Accessibility Inspector-> ON

It appears that UI Automation looks for the element's name in the Title field rather than the documented Accessibility Label field; at least, that's my experience. Adding a Title to your UI elements (via Attributes) should result in the desired behaviour.

Update: It now appears, after further experimentation, that the field to edit may be the Accessibility Identifier (not Label), which AFAICT can only be set programmatically.

According to UI Automation Reference Guide

UIAElementArray section, you may want to try like this:

var textfields = view.textFields();

textfields.withName("foo")[0].setValue("testuser");
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!