所以我有一个我想从弹出窗口中获取的文本
当我在 calabash-android 上运行以下查询时:
query("* id:'my_object_id', text")[0]
然后我得到我想要检查的文本
但是如果我在我的代码 Xamarin 上运行:
app.Query(c => c.Id("my_object_id")).Length; ==> I am getting 0
app.Query(c => c.Id("my_object_id"))[0].Text; ==> Null
我尝试了所有其他方法:
app.Query(c => c.Marked("my_object_id"))[0].Text; ==> Null
app.Query(c => c.Class("TextView").Descendant().Id("my_object_id")).FirstOrDefault().Text; ==> Null
我终于找到了解决它的方法,但我不太喜欢这个解决方案:
app.Query(c => c.Property("text").Contains("a small part of the text that I want to check")).Length; ==> I got 1
app.Query(c => c.Property("text").Contains("a small part of the text that I want to check"))[0].Text; ==> I am getting the full text that i want to check
这种“奇怪”的行为有什么解释吗?