FluentAutomation icon indicating copy to clipboard operation
FluentAutomation copied to clipboard

Assert any element has the text

Open vorou opened this issue 10 years ago • 0 comments

In order to assert on element's text I do the following:

I.Assert.Text("expected text").In(".row");

Now, I want to find multiple elements and assert that any of them has the text. I found a way to do it using .FindMultiple:

var texts = I.FindMultiple(".row").Elements.Select(el => el.Item2().Text);
I.Assert.True(() => texts.Any(t => t.Contains("expected text")));

Am I right there is no cleaner way to do it?

vorou avatar Nov 13 '14 12:11 vorou