[英]casperJS not logging to console
Learning CasperJS 学习CasperJS
Trying to understand why the following is not displaying my results in the console.... 试图理解为什么以下不在控制台中显示我的结果....
output: 输出:
casperjs testcasper.js
[info] [phantom] Starting... [info] [phantom] Running suite: 3 steps [info] [幻影]开始...... [info] [幻影]跑步套房:3个步骤
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();
casper.exit()
must be called asynchronously after all the steps having been executed; 在执行完所有步骤后,必须异步调用casper.exit()
; in your script, this gives: 在你的脚本中,这给出了:
casper.run(function() {
console.log(this.getCurrentUrl(),'info');
this.exit();
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.