将casperjs从1.9.8升级为使用phantomjs 2.0

将casperjs从1.9.8升级为使用phantomjs 2.0,phantomjs,casperjs,Phantomjs,Casperjs,我读到人们已经找到了让casperjs使用phantomjs 2.0的方法,但是我该如何升级呢?例如,仅将/usr/../casperjs/node_modules/phantomjs中的phantomjs文件夹替换为phantomjs2的文件夹似乎不起作用。我还在lib/bootstrap.js中进行了更改,以处理使用2.0时出现的警告 我正在使用mocha casperjs创建我的测试。如果您想使用PhantomJS 2,那么您当前需要 安装(支持PhantomJS 2)并更改mocha

我读到人们已经找到了让casperjs使用phantomjs 2.0的方法,但是我该如何升级呢?例如,仅将/usr/../casperjs/node_modules/phantomjs中的phantomjs文件夹替换为phantomjs2的文件夹似乎不起作用。我还在lib/bootstrap.js中进行了更改,以处理使用2.0时出现的警告


我正在使用mocha casperjs创建我的测试。

如果您想使用PhantomJS 2,那么您当前需要

  • 安装(支持PhantomJS 2)并更改mocha casperjs中的固定路径或
  • 删除CasperJS中的PhantomJS版本检查,如图所示
将mocha casperjs中的固定路径更改为:

$mcPath/../../casperjs/bin/casperjs$mcPath/cli.js--mocha casperjs path=$mcPath/$* 到

path/to/casperjs$mcPath/cli.js--mocha casperjs path=$mcPath/$* 或者如果casperjs在路径中:

casperjs $mcPath/cli.js --mocha-casperjs-path=$mcPath/.. $* casperjs$mcPath/cli.js--mocha casperjs path=$mcPath/$* PhantomJS版本

我建议您也保留PhantomJS的多个版本,如果需要的话。目前还没有正式的PhantomJS 2版本,所以您需要自己构建它,或者相信zeevl,他似乎有:

npm-g安装phantomjs2
好的,我试试看。我在虚拟机上全局安装phantomjs2时遇到了一点问题(有一个ELIFECYCLE错误说在phantomjs2@2.0.0安装脚本'node install.js'),尽管它在我的本地机器上安装得很好。我真的没有。我自己编译了PhantomJS2 raspberry pi。 path/to/casperjs $mcPath/cli.js --mocha-casperjs-path=$mcPath/.. $* casperjs $mcPath/cli.js --mocha-casperjs-path=$mcPath/.. $* npm -g install phantomjs2