javascript - Selenium 通过 Node.js 和 webdriverIO : timeout without effect

标签 javascript node.js selenium webdriver-io

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)
}

有什么建议吗?

最佳答案

要延迟队列执行,请使用暂停而不是超时

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

关于javascript - Selenium 通过 Node.js 和 webdriverIO : timeout without effect,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33747502/

相关文章:

javascript - 我的 .在计算器中。我只需要一个点

javascript - $.ajax 显示 "�"而不是重音符号,例如 "é"或 "ã"

javascript - 等待两个异步函数完成,然后在 Node.js 中继续

node.js - 当用户点击不同的url时,nodejs + express自动重定向

java - 使用 selenium.open() 打开带参数的 URL

javascript - 脚本无法在 Wordpress 中正确检测 jQuery

javascript - 无法从 View 获取值到模型

node.js - 一般搜索 : search between multiple collections (Express/mongoose)

java - 制作驱动程序 'universal'

python - Xpath 元素在 Selenium 中不匹配,但在浏览器控制台中匹配