mercredi 16 novembre 2016

webdriver io standalone wait commands don't seem to work

I'm running webdriverio (standalone) with phantomjs-prebuilt in my own custom test suite. My test page attaches a class of "test-completed" to the html tag. I want webdriverio to inspect the html after a class has been added but can't seem to get any of the waiting functions to work. My code works without them...what am I doing wrong. Here are some examples:

This works:

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

This doesn't:

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

Neither does something like this:

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

Anybody have an ideas?

Aucun commentaire:

Enregistrer un commentaire