0
我試圖通過鏈接列表循環,並對每個鏈接執行一些操作。 WebdriverIO對於所有API的測試代碼(如mocha)是同步的。但是如何將現有的node.js代碼集成到同步流程中。對於下面的代碼WebdriverIO中的循環列表
const assert = require('assert');
常量webdriverio =需要( 'webdriverio')
描述( 'webdriver.io頁',函數(){
it('should be a pending test');
before(() => {
var options = {
desiredCapabilities: {
browserName: 'chrome'
}
};
client = webdriverio.remote(options)
return client.init();
})
after(function() {
browser.end();
});
it('should have the right title - the fancy generator way', function() {
var list = ["https://www.google.com", "https://www.yahoo.com", "https://www.github.com"]
for(var i = 0 ; i < list.length;i++){
browser.url(list.length);
var title = browser.getTitle();
browser.saveScreenshot('./snapshot' + i + '.png').call(function(){
fs.exists(screenshotPath, function(fileExists) {
fileExists.should.be.true;
done();
})
});
}
});
});
問題不明確。請提供一些更多信息 –
我想知道如何從不太瞭解Promise的新手按特定順序控制Webdriver.io。雖然上面正在測試跑步者像wdio testrunner,但我還沒有嘗試過。其他選項將是異步/等待或套接字承諾電話 – Effectura
根據此鏈接:https://github.com/webdriverio/webdriverio/issues/2312 – Effectura