从1.9.8升级casperjs以使用phantomjs 2.0 [英] Upgrading casperjs to use phantomjs 2.0 from 1.9.8
问题描述
我读到人们已经找到了使casperjs与phantomjs 2.0一起工作的方法,但是我该如何升级?例如,仅将/usr/.../casperjs/node_modules/phantomjs中的phantomjs文件夹换为phantomjs2的文件夹似乎并不能解决问题.我还对lib/bootstrap.js进行了更改,以处理使用2.0发出的警告.
I read that people have found ways to get casperjs to work with phantomjs 2.0 but how could I do the upgrade? For example just swapping out phantomjs folder in /usr/.../casperjs/node_modules/phantomjs with a folder for phantomjs2 doesn't seem to do the trick. I've also made the changes in lib/bootstrap.js to handle the warnings from using 2.0.
我正在使用mocha-casperjs创建测试.
I'm using mocha-casperjs to create my tests.
推荐答案
如果要使用PhantomJS 2,则当前需要使用两者之一
If you want to use PhantomJS 2, then you currently need to either
- 从git中安装 CasperJS(支持PhantomJS 2)并在mocha-casperjs或
- 如在此处 所示,删除CasperJS中的PhantomJS版本检查.
- install CasperJS from git (which supports PhantomJS 2) and change the fixed path in mocha-casperjs or
- remove the PhantomJS version checks in CasperJS as seen here
从以下位置更改mocha-casperjs中的固定路径(在mocha-casperjs/bin/mocha-casperjs中):
Change the fixed path in mocha-casperjs (in mocha-casperjs/bin/mocha-casperjs) from:
$mcPath/../../casperjs/bin/casperjs $mcPath/cli.js --mocha-casperjs-path=$mcPath/.. $*
到
path/to/casperjs $mcPath/cli.js --mocha-casperjs-path=$mcPath/.. $*
或casperjs是否在PATH中:
or if casperjs is in the PATH:
casperjs $mcPath/cli.js --mocha-casperjs-path=$mcPath/.. $*
PhantomJS版本
我建议您还保留PhantomJS的多个版本,并在需要时在它们之间切换.当前没有正式的PhantomJS 2版本,因此您需要自己构建它或信任zeevl,后者似乎具有已编译的PhantomJS 2 for Linux :
I suggest that you also preserve multiple versions of PhantomJS and switch between them if you need it. Currently there is no official PhantomJS 2 version, so you will need to build it yourself or trust zeevl who seems to have compiled PhantomJS 2 for Linux:
npm -g install phantomjs2
这篇关于从1.9.8升级casperjs以使用phantomjs 2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!