node-phantom
node-phantom copied to clipboard
page.evaluate(func, callback, param). param can not be a Function.
params can be Function in phatomjs, but node-phantom currently does not support it.
function getBodyHTML(){
return document.body.innerHTML
}
var phantom = require('node-phantom')
phantom.create(function(_, ph){
ph.createPage(function(_, page){
page.open('http://example.com', function(_, status){
console.log(status);
page.evaluate(function(aFunc) {
return aFunc() // FAILED HERE !!!!!!!
}, function(_, ret){
console.log(ret)
}, getBodyHTML)
})
})
})
I currently solve the problem by func.toString() then eval. But I would like node-phantom can support function serialize.
+1
+1