I'm using PhantomJS page.evaluate() to do some scraping. My problem is that the code I pass to the webkit page is sandboxed, and so has no access to the variables of my main phantom script. This makes it hard make the scraping code generic.
page.open(url, function() {
var foo = 42;
page.evaluate(function() {
// this code has no access to foo
console.log(foo);
});
}
How could I push arguments into the page?
The change has been pushed and now you can use it as
The push details are here: https://github.com/ariya/phantomjs/commit/81794f9096
Can't you just bind the args to the function??