Coypu 等待两个元素之一出现

Coypu wait until one of the two elements is present

我使用 Coypu 进行测试。

我如何才能等到某个 css 出现或某个文本出现?

现在我的解决方案是这样的:

browser.Visit(uriContext.Uri.ToString());
var deadline = DateTime.UtcNow.Add(WebAppWarmUpTimeout);
while (DateTime.UtcNow < deadline)
{
    if (browser.HasContent("404 - File or directory not found.", SmallTimeoutOptions))
    {
        Assert.Fail("404");
    }
    else if (browser.FindCss("body nav a", "Job Search", SmallTimeoutOptions).Exists())
    {
        break;
    }
}

有更好的方法吗?

我承认没有仔细阅读整个文档,它就在那里 - https://github.com/featurist/coypu#finding-states-nondeterministic-testing

来源:

P.S.

感谢 Adrian Longley,他在 github 页面上迅速回答了我的问题 - https://github.com/featurist/coypu/issues/187