Reputation: 317
I tried to visit the webpage and capture with casperjs, but nothing showed in .png and no final html DOMs generated.(Page works perfectly in chrome browser)
Code:
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();
I'm using CasperJS version 1.1.2 and phantomjs version 2.1.1
Any idea is very much appreciated and thanks in advance!
Upvotes: 0
Views: 751
Reputation: 2306
Add this to the end of your script:
casper.on("page.initialized", function(page) {
page.evaluate(function() {
delete window.callPhantom;
delete window._phantom;
});
});
Basically the site is checking if you are using PhantomJS.
Since CasperJS runs on top of it (by default) you are seeing nothing
Upvotes: 3