[英]Can't Open page with facebook plugin casperJS
我嘗試打開使用Facebook插件的頁面,但是casperJS不會加載它。 如何使用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();
});
結果:
[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
我嘗試打開使用Facebook插件的頁面,但是casperJS不會加載它。 如何使用Facebook插件加載頁面?
問題實際上不是CasperJS,而是PhantomJS。 在SlimerJS引擎上運行時,相同的腳本可以正常工作。
我嘗試使用以下腳本在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.