简体   繁体   English

无法使用Facebook插件casperJS打开页面

[英]Can't Open page with facebook plugin casperJS

I try to open page where we use facebook plugin, but casperJS does not load it. 我尝试打开使用Facebook插件的页面,但是casperJS不会加载它。 How to load pages with facebook plugin? 如何使用Facebook插件加载页面?

var casper = require("casper").create({
          verbose: true,
          logLevel: 'debug',
          pageSettings: {
            userAgent: 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0'
          }
        }),
        utils = require('utils');

    casper.start();

    casper.thenOpen('http://bookmate.com', function(response) {
      this.echo(this.getTitle());
    });

    casper.run(function() {
      console.log('End');
      casper.exit();
    });

result: 结果:

[info] [phantom] Starting...
[info] [phantom] Running suite: 2 steps
[debug] [phantom] opening url: http://bookmate.com/, HTTP GET
[debug] [phantom] Navigation requested: url=http://bookmate.com/, type=Other, willNavigate=true, isMainFrame=true
[debug] [phantom] url changed to "http://bookmate.com/"
[debug] [phantom] Navigation requested: url=https://www.facebook.com/plugins/facepile.php?app_id=124791507543584&href=http://facebook.com/bookmate&action=like&width&height=70&max_rows=1&colorscheme=light&size=medium&show_count=true, type=Other, willNavigate=true, isMainFrame=false

I try to open page where we use facebook plugin, but casperJS does not load it. 我尝试打开使用Facebook插件的页面,但是casperJS不会加载它。 How to load pages with facebook plugin? 如何使用Facebook插件加载页面?

The issue is not actually with CasperJS but with PhantomJS. 问题实际上不是CasperJS,而是PhantomJS。 The same script works fine when you run against a SlimerJS engine. 在SlimerJS引擎上运行时,相同的脚本可以正常工作。

I tried to open the page on phantomjs using the below script and see that it hangs. 我尝试使用以下脚本在phantomjs上打开页面,并看到它挂起。

var page = require('webpage').create();
var url = 'http://bookmate.com/';
page.open(url, function (status) {
  //Page is loaded!
  phantom.exit();
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM