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无效。无论我选择使用哪个参数调用.timeouts(['scrip'|'implicit'|'page load'], ms).,都几乎在moveToObject之后立即截取了屏幕截图。

通过回调函数我也得到了相同的结果:

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


有什么建议么?

最佳答案

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

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

关于javascript - Selenium通过Node.js和WebdriverIO:超时无效,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33747502/

10-11 13:22