【问题标题】:webdriver io standalone wait commands don't seem to workwebdriver io 独立等待命令似乎不起作用
【发布时间】:2016-11-16 18:10:55
【问题描述】:

我在我自己的自定义测试套件中运行带有 phantomjs-prebuilt 的 webdriverio(独立)。我的测试页在 html 标记上附加了一个“测试完成”类。我希望 webdriverio 在添加类后检查 html,但似乎无法让任何等待功能正常工作。我的代码没有它们就可以工作......我做错了什么。以下是一些示例:

这行得通:

webdriverio
.remote(options)
.init()
.url('./tests.html')
.getTitle().then(function(title) {
    console.log('Title was: ' + title);
})
.end();

这不是:

webdriverio
.remote(options)
.init()
.url('./tests.html')
.waitForExist('html.tests-completed')
.getTitle().then(function(title) {
    console.log('Title was: ' + title);
})
.end();

也不做这样的事情:

 webdriverio
.remote(options)
.init()
.url('./tests.html')
.waitUntil(function(){
    return webdriverio.isExisting(
        'html.tests-completed', 1000, 
        'tests not yet complete', 500
    );
})
.getTitle().then(function(title) {
    console.log('Title was: ' + title);
})
.end();

有人有想法吗?

【问题讨论】:

    标签: testing phantomjs webdriver-io


    【解决方案1】:

    尝试从 waitForExist 选择器中删除 html

    webdriverio
    .remote(options)
    .init()
    .url('./tests.html')
    .waitForExist('.tests-completed')
    .getTitle().then(function(title) {
        console.log('Title was: ' + title);
    })
    .end();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-03-27
      • 2019-01-03
      • 1970-01-01
      • 1970-01-01
      • 2011-10-18
      • 2015-01-29
      • 2021-09-12
      相关资源
      最近更新 更多