【发布时间】:2017-05-12 09:44:54
【问题描述】:
我使用 nightmare 爬取了一个网页,在窗口中,我可以发现所有项目都已加载,但无法打印某些项目的 html 代码。
有什么建议吗?
我的代码。
var Nightmare = require('nightmare');
var nightmare = Nightmare({
show: true,
webPreferences: {}})
nightmare
.goto('http://music.163.com/')
.viewport(1600, 900)
.wait(5000)
.evaluate(function() {
return document.documentElement.innerHTML;
})
.end()
.then(function(res) {
console.log('source code:', res); // not all the html code printed!
});
【问题讨论】:
-
为我工作。您面临的具体问题是什么?