PhantomJSのインストール
サクッと brew install phantomjs
といきたいところだけど今現在(2015/12/15)まだパッケージがないらしい。
$ brew install phantomjs
phantomjs: This formula either does not compile or function as expected on OS X
versions newer than Yosemite due to an upstream incompatibility.
Error: An unsatisfied requirement failed this build.
公式バイナリをインストール
homebrew – El Capitan にPhantomJS 2.0をインストールする – Qiitaを参考に公式バイナリをダウンロードしてくる。
- /usr/local/bin にインストールする
$ cp /path/to/phantomjs /usr/local/bin/
- upxをつかってパッケージングし直さないと使えないっぽい
$ brew install upx
$ upx -d /usr/local/bin/phantomjs
$ phantomjs
phantoms>
となれば動作OK
簡単なスクリプトを試す
#!perl use v5.12; use Selenium::PhantomJS; my $driver = Selenium::PhantomJS->new(); $driver->get('http://www.google.com'); say $driver->get_title(); $driver->quit();
Filed under: perl
Trackback Uri
最近のコメント