I want to display my page and exit PhantomJS in the evaluation function, because I want to call it when a certain event is triggered.
I tried something like this:
page.evaluate(page, function (page, phantom) { //do some stuff on my page //i want to execute this in an eventhandler of my page though thats not the problem page.render('imgName.png'); page.render('pdfName.pdf'); phantom.exit(); }, page, phantom);
This does not work in my example because page.render seems undefined. Maybe there is a serializer for arguments that does not serialize obj functions?
Is it possible? Does anyone know a solution to my problem?
I know that I can set the while loop in my evaluation function and prevent it from completing, and after that this page will be displayed outside. I do not like this.
javascript phantomjs
Juhwon
source share