UiAutomator 在使用 UiAutomator 做 UI 自动化时,拿不到属性的 id 或者 text 为空时怎么处理

夏杰 · September 06, 2017 · Last by 金主 replied at September 07, 2017 · 1198 hits

最近在用 UI automator 做 UI 自动化,在使用 Uiautomatorviewer 定位页面元素时,id 为空,text 也为空,又不想用坐标的方式,因为这样移植性不好,请问还有别的方式操作吗?

共收到 5 条回复 时间 点赞

用 class 找出一组元素,然后用下标区分

用 xpath 或者 class 的属性,然后区分

aiyanyuan 回复

你好,请问 xpath 有时不稳定是怎么回事?

那是不是你们那边的开发在经常改代码?不然不会不稳定吧

find_elements_by_class_name

需要 Sign In 后方可回复, 如果你还没有账号请点击这里 Sign Up