0

我用海狸鼠进行测试。

我怎样才能等到某个 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;
    }
}

有更好的方法吗?

4

1 回答 1

0

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

从来源:

在此处输入图像描述

附言

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

于 2018-06-19T14:18:18.697 回答