Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of babel polyfill #60

Open
eugen35 opened this issue Sep 30, 2018 · 0 comments
Open

Use of babel polyfill #60

eugen35 opened this issue Sep 30, 2018 · 0 comments

Comments

@eugen35
Copy link

eugen35 commented Sep 30, 2018

I use the code:
`.then(function (phantom) {

var page = phantom.createPage();
var jqueryPath = path.resolve(__dirname, "jquery-3.2.1.min.js");
var babelPolyfillPath = path.resolve(__dirname, "babel-polyfill.js");

return page.run(jqueryPath, babelPolyfillPath, function (jqueryPath, babelPolyfillPath, resolve, reject) {
  var page = this;

  page.onInitialized = function () {
    page.injectJs(babelPolyfillPath);
    page.injectJs(jqueryPath);
    console.log('init');
  };
  
  page.onConsoleMessage = function (msg){console.log('(PAGE CONSOLE:) '+ msg);};

  page.open("http://localhost:3000/", function (status) {        
    var p= page.evaluate(function () {        
     $("button").click().click().click();
     return $("div").last().text();        
   });
    resolve(p);
  });
});

})`

when in loaded page (http://localhost:3000/) used let or const (for example <script> let i=0; </script>) there occures an error:
"ReferenceError: Can't find variable: i"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant