casperjsのインストール
sudo su
cd /usr/local/src
git clone https://github.com/n1k0/casperjs.git
cd casperjs
ln -sf `pwd`/bin/casperjs /usr/local/bin/casperjs
phantomjsのインストール
cd /usr/local/src
git clone https://github.com/ariya/phantomjs.git
cd phantomjs
./build.sh
なんかエラーが出る。
TIQUE -O2 -Wall -W -fPIE -I../../../mkspecs/linux-g++ -I. -o icu.o icu.cpp
icu.cpp:42:28: error: unicode/utypes.h: No such file or directory
icu.cpp:43:26: error: unicode/ucol.h: No such file or directory
icu.cpp:44:29: error: unicode/ustring.h: No such file or directory
icu.cpp: In function ‘int main(int, char**)’:
icu.cpp:48: error: ‘UErrorCode’ was not declared in this scope
icu.cpp:48: error: expected ‘;’ before ‘status’
icu.cpp:49: error: ‘UCollator’ was not declared in this scope
icu.cpp:49: error: ‘collator’ was not declared in this scope
icu.cpp:49: error: ‘status’ was not declared in this scope
icu.cpp:49: error: ‘ucol_open’ was not declared in this scope
icu.cpp:50: error: ‘U_FAILURE’ was not declared in this scope
icu.cpp:52: error: ‘ucol_close’ was not declared in this scope
gmake: *** [icu.o] Error 1
ICU disabled.
The ICU library support cannot be enabled.
Turn on verbose messaging (-v) to /usr/local/src/phantomjs/src/qt/qtbase/configure to see the final report.
If you believe this message is in error you may use the continue
switch (-continue) to /usr/local/src/phantomjs/src/qt/qtbase/configure to continue.
軽く調べた感じだと、
yum install gcc gcc-c++ make git openssl-devel freetype-devel fontconfig-devel
を入れた後に1.9にcheckoutするといいらしい。
git checkout 1.9
./build.sh
bin/phantomjs -v
ln -sf `pwd`/bin/phantomjs /usr/local/bin/phantomjs
これで、
[root@localhost]/usr/local/src/phantomjs# phantomjs -v
1.9.7
[root@localhost]/usr/local/src/phantomjs# casperjs --version
1.1.0-beta3
こうなった。casperjsが動くかどうか、サンプルを実行する。
var casper = require('casper').create();
casper.start('http://casperjs.org/', function() {
this.echo(this.getTitle());
});
casper.thenOpen('http://phantomjs.org', function() {
this.echo(this.getTitle());
});
casper.run();
$ casperjs sample.js
CasperJS, a navigation scripting and testing utility for PhantomJS and SlimerJS
PhantomJS | PhantomJS