2016-11-16 46 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();