为什么AppResult的Label属性中的字符串无法通过Property(“label”)进行查询?
问题描述:
当我查询与为什么AppResult的Label属性中的字符串无法通过Property(“label”)进行查询?
app.Query(c=>c.Marked("02_Voided_NotReviewed"))
我得到这样的结果:
[[0] {Id => null, Description =>
"md5b60ffeb829f638581ab2bb9b1a7f4f3f.FormsImageView{d0c6be9 V.ED.....
........ 0,0-80,80}",
Rect => {Width => 80, Height => 80, X => 0, Y => 718, CenterX => 40, CenterY
=> 758},
Label => "02_Voided_NotReviewed",
Text => null,
Class => "md5b60ffeb829f638581ab2bb9b1a7f4f3f.FormsImageView",
Enabled => true }, ...
我的第一个困惑是,documentation为Marked
没有提到它搜索Label
属性为Android。所以我认为它应该返回0结果,但现在是主要问题。我想使用Property
,所以我可以过滤更一般的结果,但为了简单起见,我正在查询确切的字符串。
当我与
app.Query(c=>c.Property("label").Contains("02_Voided_NotReviewed"))
查询,我得到0的结果。我试过Property("Label")
和Property("label")
。 Contains
,StartsWith
和Like
也返回0结果。当我使用Property("text")
并在Text属性中查询字符串时,我确实得到了结果,所以我认为这与label
属性有关。有没有其他人遇到这个问题,或可以看到我做错了什么?
答
的documentation you linked来说,Marked
方法
匹配共同的价值观。对于Android:指定值为
id
,contentDescription
或text
的元素。
它不是立即显现,但Label
属性,您在UITest看到被映射到Android元素的contentDescription
所以这应该工作:
app.Query(c=>c.Property("contentDescription").Contains("02_Voided_NotReviewed"))
这完美地工作。我无法相信这是对'contentDescription'指的是什么的误解。非常感谢!!! –