且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

CasperJS:如何退出脚本执行?

更新时间:2023-12-05 21:19:16

casper.then(function() {
    this.exit();
});

是否要在脚本运行时退出脚本(由于错误)?如果不是,则无需像这样显式退出它.定义所有测试后,只需调用casper.run(),一旦所有测试运行完毕(无论结果如何),该脚本就会停止运行,并且您将重新获得对终端的控制权.

Do you want to exit the script while it's running (due to an error)? If not, then you don't need to explicitly exit it like that. Just call casper.run() after defining all your tests, and once all the tests have run (regardless of their result), the script will stop running and you'll regain control over your terminal.