【问题标题】:Coypu wait until one of the two elements is presentCoypu 等到两个元素之一出现
【发布时间】:2018-06-19 22:18:18
【问题描述】:

我使用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;
    }
}

有没有更好的方法?

【问题讨论】:

    标签: c# ui-automation coypu


    【解决方案1】:

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

    来源:

    附言

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

    【讨论】:

      猜你喜欢
      • 2016-06-19
      • 1970-01-01
      • 1970-01-01
      • 2022-12-10
      • 2018-01-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多