通过 Node.js 和 webdriverIO 的 Selenium:超时无效

Selenium via Node.js and webdriverIO: timeout without effect

testfile.js

var webdriverio = require('webdriverio');
var options = {
    desiredCapabilities: {
        browserName: 'firefox'
    }
};

webdriverio
    .remote(options)
    .init()
    .url('http://localhost/proj/index.php')
    .moveToObject('div.media')             // Move to DIV
    .timeouts('implicit',6000)             // Wait...
    .saveScreenshot('./snapshot1.png')     // Take Screenshot
    .end();

.timeouts 无效。屏幕截图几乎是在 moveToObject 之后立即截取的,无论我选择使用哪个参数调用 .timeouts(['scrip'|'implicit'|'page load'], ms).

我用回调函数也得到了同样的结果:

.timeouts('implicit',6000).then(function(){
    this.timeouts('implicit',6000)
}

有什么建议吗?

要延迟队列执行,请使用 pause 而不是 timeouts

http://webdriver.io/api/utility/pause.html