您可以将一个博士阶层对象传递给casperjs.create(),包括js clientScripts,以注入到客户端页面。
不应该在测试文件中docs还声明实例的casper.create。
文档没有说明如何在options类中使用casper.tester对象(至少我找不到)。我确实试着做了这样的事情:
casper.options = {
clientScripts:[
'../testlib/sinon-1.7.3.js'
],
logLevel:"warning",
verbose:true
}; 在casper.test.begin之前,但它打破了测试。
把它放在test.begin和casper.start之间。
casper.test.begin('Basic index.html elements test',14, function suite(test){
casper.options..etc
casper.start(url, function(){
//also tried here而且在它下面,它也打破了测试
我会很高兴在这方面有任何方向。尤其是注射部分
发布于 2013-09-09 22:09:53
您需要将文件推送到casper.option.clientScripts上,以避免干扰casper test设置的其他选项。
casper.options.clientScripts.push("../testlib/sinon-1.7.3.js");来源:CasperJS邮件列表
https://stackoverflow.com/questions/18707588
复制相似问题