CasperJS is not included in the console

CasperJS Training

Trying to understand why the following does not display my results in the console ....

exit:

casperjs testcasper.js 

[info] [phantom] Launching ... [info] [phantom] Launching dialing: 3 steps

the code:

 var casper = require('casper').create({ loadImages: true, loadPlugins: true, verbose: true, logLevel: 'debug', }); casper.start(url, function() { this.debugPage(); this.echo("Test echo."); this.fill('form#LogonForm', { 'username': username, 'password': password, }, true); }); casper.then(function() { casper.echo("I'm loaded."); }); casper.run(function() { console.log(this.getCurrentUrl(),'info'); }); //casper.log('this is a debug message', 'debug'); //casper.log('and an informative one', 'info'); //casper.log('and a warning', 'warning'); //casper.log('and an error', 'error'); casper.exit(); 
+6
source share
1 answer

casper.exit() should be called asynchronously after all steps taken; in a script, this gives:

 casper.run(function() { console.log(this.getCurrentUrl(),'info'); this.exit(); }); 
+6
source

Source: https://habr.com/ru/post/906768/


All Articles