2016-11-16 42 views
0

我正在使用phantomjs-prebuilt在我自己的自定义测试套件中运行webdriverio(standalone)。我的测试页将一类“测试完成”附加到html标签。我希望webdriverio在添加完课程后检查html,但似乎无法获得任何等待的功能。我的代码没有他们......我做错了什么。下面是一些例子:webdriver io standalone等待命令似乎不起作用

这工作:

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(); 

任何人有一个想法?

回答

0

尝试从waitForExist选择删除HTML

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