如何在 UIATablecell 中访问图像 [英] How to access images in UIATablecell

查看:24
本文介绍了如何在 UIATablecell 中访问图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 iOS7 上的 UIAutomation 验证图像是否显示/隐藏.

I'm trying to validate that an image is showing/hidden using UIAutomation on iOS7.

我遇到的问题是 .cells()[0].images() 总是返回 [object UIAElementNil] 即使我可以看到我的图片.我还尝试在主窗口上调用 images(),但也没有成功.

The problem that i'm running into is that .cells()[0].images() always return [object UIAElementNil] even though I can see my image. I also tried calling images() on the main window, but no luck either.

任何帮助表示赞赏.谢谢.

Any help appreciated. Thanks.

推荐答案

这在 UI 自动化中是不可能的.表格单元格不允许您访问内部的任何内容,这是由 UI 自动化的工作方式和单元格层次结构的外观造成的.

This is not possible in UI Automation. Table cells don't let you access anything inside, which is caused by the way UI Automation works an how the cell hierarchy looks like.

您可以对您的实现进行一些更改,并使用 UIAccessibilityContainer 方法在 UI 自动化中访问您的单元格图像.不过,这有点复杂.

You could do some changes to your implementation and make your cell images accessible in UI Automation by using UIAccessibilityContainer methods. However, that's a bit complicated.

您还可以检查 value().UI 自动化将所有单元格内容视图转换为一个字符串,有时只需检查这个字符串就可以检查内容.

You can also inspect value(). UI Automation converts all cell content views into a string and sometimes it is possible to check content just by checking this one string.

如果一切都失败了,就去寻找另一个测试框架.有几个开源&付费框架比 UI 自动化更强大,文档也更丰富.

If everything fails, just go for another testing framework. There are several open source & paid frameworks that are more robust and much more documented than UI Automation.

这篇关于如何在 UIATablecell 中访问图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆