peerigon / phridge

A bridge between node and PhantomJS
The Unlicense
519 stars 44 forks source link

Please, give an example of load and use jquery #58

Open eugen35 opened 6 years ago

eugen35 commented 6 years ago

var phridge = require("phridge"); var path = require("path"); var jqueryPath = path.resolve(__dirname, "jquery-1.6.1.min.js");

phridge.spawn() .then(function (phantom) { return phantom.openPage("http://localhost:3000/"); }) .then(function (page) { page.injectJs(jqueryPath); return page.run(function () { return this.evaluate(function () { return $("button").innerText; }); }); })

gives an error: TypeError: page.injectJs is not a function