PhantomJS + CasperJS 安装和配置

下载: https://bitbucket.org/ariya/phantomjs/downloads

linux配置:
1. 配置
gedit .bash_profile
——————————–
export PHANTOMJS_HOME=/mnt/D/OutsourcingServer/phantomjs
export CASPERJS_HOME=/mnt/D/OutsourcingServer/casperjs
PATH=…………..:$PHANTOMJS_HOME/bin:$CASPERJS_HOME/bin

source .bash_profile  //使改变马上生效

测试:
[pandy@pandy-linux ~]$ phantomjs –version
1.9.2

[pandy@pandy-linux ~]$ casperjs –version
1.1.0-beta3

2.创建一个js: SaveChallengeMySelfService.js

3.到SaveChallengeMySelfService.js的位置执行:
[pandy@pandy-linux SandBag]$ casperjs SaveChallengeMySelfService.js
后台输出: 打开百度, 截图完毕.
同时生成/mnt/D/OutsourcingServer/OutsourcingServerTest/src/main/webapp/SandBag/test.png图片。