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