dhat
@dhat

Не работает скрипт PhantomJS, где ошибка?

Простой скрипт, повторяю все как в видео - но не пашет.

var system = require('system');
var args = system.args;
var url = 'http://packtpub.com/';
var page = require('webpage');

// START
page.onError = function(msg, trace) {

  var msgStack = ['ERROR: ' + msg];

  if (trace && trace.length) {
    msgStack.push('TRACE:');
    trace.forEach(function(t) {
      msgStack.push(' -> ' + t.file + ': ' + t.line + (t.function ? ' (in function "' + t.function +'")' : ''));
    });
  }

  console.error(msgStack.join('\n'));

  phantom.exit(1);

};
// END

// handler for reciever resources
page.onResourceReceived = function(response) {
  console.log(response.contentType);
};

// react to any loaded page
page.onLoadFinished = function() {
  console.log('************');
  console.log('Page loaded');
  phanton.exit();
};

page.open( url );


Консоль пишет:
TypeError: undefined is not a function (evaluating 'page.open( url )')

  phantomjs://code/network.js:37 in global code
  • Вопрос задан
  • 497 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы