Reputation: 775
I'm fairly new to casperjs (running on phantomjs) - I'm sure I'm probably missing a basic programming element here; looking to see if anyone has some insight. At the end of my script I call casper.exit()
, which does exit the script and seemingly steps back into the current directory, however the current directory is not displayed in the command window.
I don't think it's related to the script itself and I can replicate with even the most basic scripts. Below is a screenshot of the outcome:
Where the yellow circle is after the .exit()
call, and I would be expecting to see the cd (underlined in red)
I've tried using casper.die()
with similar results.
Although it's not a big deal, it might be confusing to someone less familiar with casper/phantom and the script itself.. I guess I'm left with a few questions:
casper.die()
and casper.exit()
? I see that .die()
logs a status message but other than that is there a preferred method to stop script execution or is it just syntactics, as in PHP ? Upvotes: 0
Views: 1056
Reputation: 61892
It is the normal behavior of the casperjs executable on windows. This has likely something to do with the python part of the executable since phantomjs does not have this behavior.
Another indicator is that when casperjs is run through phantomjs like described here, there is no such behavior and I get a normal prompt after exit.
I would say, this is a cosmetic problem that can throw you off when you first encounter it. This isn't really a problem.
Regarding the Bonus question: die
can be seen as a fancier exit
since it calls exit
itself, but it is a more controlled way to exit casper. There is an optional message that is written to stout in red and an additional die
event handler. die
also sets the execution time of the script.
Upvotes: 1