Tom*_*art 7 xcode uitableview ios xcode7 xcode-ui-testing
我有一个包含大量单元格的表视图,而不是每个单元格都在屏幕上可见.当我检查时
table.cells.staticTexts.matchingIdentifier("My Cell").element.exists
Run Code Online (Sandbox Code Playgroud)
它返回true但屏幕上看不到单元格,我无法点击它.因为每当我点击它时,测试都会失败.
如何检查元素在屏幕上是否可见?或者如何点击不可见的元素?
使用hittable属性而不是exists.
XCUIElement的类引用说明hittable只有true在可以触摸元素时,属性才会返回.
table.cells.staticTexts.matchingIdentifier("My Cell").element.hittable
Run Code Online (Sandbox Code Playgroud)
小智 0
不要使用 element.exists 尝试使用 element.hittable。这对我有用,如果元素当前位于显示层次结构中,即使它位于屏幕视图之外,存在也会返回 true。仅当元素位于屏幕上且其可命中时,hittable 才返回 true。
| 归档时间: |
|
| 查看次数: |
2979 次 |
| 最近记录: |