简体   繁体   中英

Can't Open page with facebook plugin casperJS

I try to open page where we use facebook plugin, but casperJS does not load it. How to load pages with facebook plugin?

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. How to load pages with facebook plugin?

The issue is not actually with CasperJS but with PhantomJS. The same script works fine when you run against a SlimerJS engine.

I tried to open the page on phantomjs using the below script and see that it hangs.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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