标签的UITest颜色(不是UI标签) [英] UITest color of a label (not UI label)

查看:43
本文介绍了标签的UITest颜色(不是UI标签)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我正在使用的桌子的照片.

Here is a pic of the table I'm working with.

我只是想获得"requested"(灰色)或"draft"(橙色)的颜色.我可以通过以下方式获取"requested"或"draft"的实际字符串

I'm just trying to get the color of "requested" (gray) or "draft" (orange). I'm able to get the actual string of "requested" or "draft" by

var timeSheetStatus = 
    app.tables.element.cells.elementBoundByIndex(0).staticTexts.elementBoundByIndex(1).label

但是这只是一个字符串,而不是UIlabel(如果是UILabel,我相信我可以做label.textColor).如何获得此字符串的颜色,以便断言它确实是灰色或橙色?

but this is just a string and not a UIlabel (if it were a UILabel I would be able to do label.textColor I believe). How do I get the color of this string so I can assert that it is indeed gray or orange?

推荐答案

恐怕您将无法通过UI测试来执行此操作.UI测试只能在Accessibility公开界面的范围内看到"该界面.因此,您可以看到"文本,但不能看到"该东西是UILabel.UI测试对此一无所知.因此,您无法探索其作为UILabel的性质.

I'm afraid you're not going to be able to do this via UI Testing. UI Testing can "see" the interface only to the extent that Accessibility exposes it. Thus you can "see" the text but you cannot "see" that this thing is a UILabel; UI Testing knows nothing of that. Thus you cannot explore its nature as a UILabel.

这篇关于标签的UITest颜色(不是UI标签)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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