casperJS 未记录到控制台
学习 CasperJS
试图理解为什么以下内容没有在控制台中显示我的结果...
输出:
casperjs testcasper.js
[info] [phantom]开始... [info] [phantom] 运行套件: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();
Learning 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
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();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
casper.exit()
必须在执行完所有步骤之后异步调用;在你的脚本中,这给出了:casper.exit()
must be called asynchronously after all the steps having been executed; in your script, this gives: