PhantomJS无法打开页面

时间:2014-02-18 12:43:13

标签: javascript backbone.js phantomjs

我正在尝试获取我的网址的html版本,因为我的骨干结构有多个javascript代码但这条线只有时工作...是的,有时工作,页面内容加载但有时幻影卡住而不是能够打开页面。事实上,它没有记录任何内容。

我玩过超时,但我什么都没有。有帮助吗?它似乎是一种没有确定性的行为。提前谢谢!

var page = require('webpage').create();

page.open('myurl', function(status) {
  if (status !== 'success') {
    console.log('FAIL to load the address')
    phantom.exit(1); 
  } else {
    console.log( "Successful page open!" );
    console.log(page.content);
    phantom.exit(0);
  }
});

0 个答案:

没有答案