javascript - Load a webpage (that uses system.js) using PhantomJS -


i'm trying load webpage using phantomjs 2.1.1. webpage in question loads system.js.

phantomjs doesn't , throws following errors:

referenceerror: can't find variable: promise http://localhost:8888/node_modules/systemjs/dist/system.js:4  referenceerror: can't find variable: systemjs http://localhost:8888/systemjs.config.js:42 

my code looks this:

var page = require('webpage').create();    page.open('http://localhost:8888/my/viewer.html', function (status)  {      console.log("status: " + status);        if (status !== "success") {          console.log("unable access network");      }      else      {          // wait document loaded & visible          sleep(5000);          docloaded();            phantom.exit();      }  });    // ===============================================================  function docloaded()  {      console.log("ajax content should visible now.");      page.render('result.png');  }  // ===============================================================
<!doctype html>  <html>    <head>      <!-- <script src="../node_modules/bluebird/js/browser/bluebird.core.min.js"></script> -->      <script src="../node_modules/systemjs/dist/system.js"></script>      <script src="../systemjs.config.js"></script>  </head>    <body>      content...  </body>    </html>


phantumjs complains systemjs.config.js calling unknown systemjs

  systemjs.config({      packages: {        '': {          defaultextension: 'js',        },      },      paths: {        'superlib-js': new url('src', baselocation).href,        'superlib-web': new url('web', baselocation).href,      },      meta: {        '*': {          scriptload: false,          esmodule: true,          babeloptions: {            es2015: false,          },        },      },      map: {        'plugin-babel': new url(pluginbabelpath, baselocation).href,        'systemjs-babel-build':          new url(systemjspluginbabelpath, baselocation).href,        'plugin-babel-cached': new url(pluginbabelcachepath, baselocation).href,      },      transpiler: iscachingpossible ? 'plugin-babel-cached' : 'plugin-babel',    });

i'm calling phantumjs using command:

phantomjs --debug=true --local-to-remote-url-access=true --load-images=true --remote-debugger-autorun=true "d:\path\to\my-webpage.js"

i did digging, partially away promise (by using bluebird), not system.js

anyone knows how fix this?


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -