【发布时间】: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