Yurii Rozhkov
Yurii Rozhkov

Reputation: 117

TestStack.White does not return element properly

I'm trying to get 2 editboxes from main application after start. Sometimes window.GetMultiple() returns me only 1 editbox. Is there any method to wait for element appearance?

Editboxes don't have automation ID or text.

Upvotes: 1

Views: 1413

Answers (2)

Tanya G.
Tanya G.

Reputation: 146

You can use Retry function to wait until exactly 2 edit boxes appear:

    Retry.For(() =>
    {
        var editBoxes = window.GetMultiple(criteria);
        Assert.AreEqual(2, editBoxes.Length);
    }, TimeSpan.FromSeconds(10));

Upvotes: 2

Max Young
Max Young

Reputation: 1662

You can use the approach ivan-danilov discusses in this issue to wait https://github.com/TestStack/White/issues/400. White already has this wait built into it and it can be configured but theirs no reason you couldn't set a specific wait for the items you are looking for. I have never done this before but you may need to catch the time out exceptions that come back from White.

var loaded = Retry.For(() => ProjectCombobox.Items.Exists(item => item.Text == id), TimeSpan.FromSeconds(5));

Upvotes: 0

Related Questions