我尝试使用下面的命令运行我的test.js文件:
DEBUG=nightmare node --harmony test.js 和获取输出:
nightmare queueing action "goto" for http://google.com +0ms
nightmare queueing action "wait" +2ms
nightmare queueing action "screenshot" +0mstest.js:
var Nightmare = require('nightmare');
var google = new Nightmare()
.goto('http://google.com')
.wait()
.screenshot("./screen.png")
.run(function(err, nightmare) {
if (err) return console.log(err);
console.log('Done!');
});没有屏幕截图和链接访问。有什么想法吗?
注意:我正在与Linux Guest一起开发Virtual Box。
发布于 2015-11-19 13:19:15
尝试使用:
var google = new Nightmare({ show: true })您将能够看到链接是否打开。
对于Debug,请尝试使用以下代码:
DEBUG=nightmare:actions node --harmony test.js这将向您显示代码抛出错误,就像您的例子一样:
nightmare:actions Not enough arguments for .wait().wait()需要时间间隔或返回true或dom元素的函数。
尝试如下所示:
.wait(2000) // For 2 sec wait
.wait("input[type='text'][title='Search']") // To wait till the search box is loaded
.wait( () => {
// Check Something
return true
})请检查上述方法是否有助于解决您的问题。
https://stackoverflow.com/questions/33791510
复制相似问题