Appium 求教:在 ios 设备上 如何获取 app 的控件 id?

Evan · 2014年04月01日 · 最后由 恒温 回复于 2014年04月02日 · 1527 次阅读

求教:在 ios 设备上 如何获取 app 的控件 id? inspector 只能获取到控件的 xpath。 有什么好的方法吗?不甚感激。

共收到 5 条回复 时间 点赞

logElementTree() 可以打印
uiautomation 官方文档有说明:
You can use the logElementTree method for any element to list all of its child elements
UIALogger.logStart("Logging element tree …");
UIATarget.localTarget().logElementTree();
UIALogger.logPass();

Evan #2 · 2014年04月01日 Author

#1 楼 @daydayup 恩 我试了,但是没法获取到具体的 id 啊?只能拿到类似于 tagname 的属性啊

有这些属性就可以定位元素了,你说的 id 在 IOS 上应该就是 accessibilityIdentifier 或者 label 了,这个如果开发有手动给自己的控件加上的话,也是可以看到的。

Evan #4 · 2014年04月02日 Author

#3 楼 @daydayup 请教下,accessibilityIdentifier 是什么?哪里可以看到啊?

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册