学习CasperJS
试图理解为什么以下内容没有在控制台中显示我的结果....
输出:
casperjs testcasper.js
[info] [幻影]开始...... [info] [幻影]跑步套件:3个步骤
代码:
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();
答案 0 :(得分:6)
casper.exit()
;在你的脚本中,这给出了:
casper.run(function() {
console.log(this.getCurrentUrl(),'info');
this.exit();
});