Nightmare.js is great library, but you cannot straightforward pass functions as arguments to the evaluation context. Phobetor uses eval to run those functions in browser's context and give you back the result.