0
我试图访问的网页,并与casperjs捕捉,但以.png没有显示也没有最终的HTML DOM的产生(页完全在Chrome浏览器)Casperjs没有渲染页面完全
代码:
var casper = require('casper').create({
verbose: true,
logLevel: 'debug'
});
casper.start("http://m.weibo.cn/status/Er9b7wxsD", function() {
this.wait(5000, function() {
this.scrollTo(0, 0);
this.echo(this.getHTML('html', true));
this.capture('all.png');
});
});
casper.run();
我使用CasperJS 1.1.2版和phantomjs版本2.1.1
任何想法非常赞赏和感谢提前!
运行尝试使用CasperJS错误记录,以检查是否tehre是错误的:http://docs.casperjs.org/en/latest/ logging.html – Vaviloff
如果您将得到的html粘贴到浏览器中,您会看到casperjs真的会在'all.jpg'中向您显示正确的东西。我试图改变userAgent和窗口大小,但他们正在使用另一种方法来检测你没有使用真正的浏览器 –
@GiacomoTecyaPigani :)感谢您的评论。我试图将核心改为Slimerjs,casperjs可以渲染网站。我不确定这是Phantomjs的问题还是网站的检测。 :( – ansvver