Search code examples
c#calabashxamarin-test-cloudxamarin.uitest

Xamarin UITest (Calabash) Query for Non-Empty text Property


In Xamarin UITest (which uses Calabash) I can query an element that has some text, like so:

app.WaitForElement(x => x.Marked("MyTextControl")
                   .Property("text")
                   .Contains("some text"));

I see in the reference docs that there is also BEGINSWITH, LIKE, and so on, but I don't see any sort of IsEmpty or IsNotEmpty. Is there a way to find an element with text that is not empty? I was expecting to see a Length method, so I could do something like:

app.WaitForElement(x => x.Marked("MyTextControl")
                   .Property("text")
                   .Length() > 0);

Is there another way to accomplish what I am after?


Solution

  • To the specific question, I do not believe it is possible to accomplish this within a specific Query in the UITest API's. The best workaround would be to what @Zil suggested and to query for all elements of a specific Identifier and then loop over them to find what you are looking for, or something similar to that idea.