CasperJS/PhantomJS unable to open Facebook

三世轮回 提交于 2019-12-14 03:55:33

问题


I've seen examples such as this one showing how to login to facebook with casperJS: How to login into a website with CasperJS?

but am unable to get this code to work for me. I'm not interested in the login portion, I just want to load any facebook page into casperjs or phantomjs but keep getting a fail on load.

Is this working for anyone else? or has facebook detected the browser and not allowing access anymore?

Here is a simplified version of what I am unable to do:

var casper = require('casper').create({
    verbose: true,
    logLevel: 'debug',
    pageSettings:{
        userAgent :'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4'    ,
        loadImages:  false,         // The WebPage instance used by Casper will
        loadPlugins: false         // use these settings
    }
});
casper.start()
casper.thenOpen('https://www.facebook.com/pfchangs', function() {

    this.echo(this.getHTML());
    //this just prints out empty page: <html><head></head><body></body></html>

});

casper.run();

I'm running this on Windows 7


回答1:


Looks like this is known bug with casperjs windows batch file:

https://github.com/n1k0/casperjs/commit/0d659f140f1e2120bed967d8301657b5fe79f19c



来源:https://stackoverflow.com/questions/13887888/casperjs-phantomjs-unable-to-open-facebook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!