Skip to content
jejacks0n edited this page Jan 11, 2013 · 10 revisions

This page provides useful information on getting PhantomJS setup, running on Linux, and common CI details.

Due to the nature of gemspecs being evaluated at package time, and not on installation, phantomjs.rb doesn't properly add the phantomjs-linux dependency on linux setups, so if you're wanting to use the gem you'll have to include it manually in your Gemfile.

Gemfile

gem "phantomjs-linux" if RUBY_PLATFORM =~ /linux/

This can cause some issues on Heroku, and since the bin file included with phantomjs-linux is compiled for 32bit versions, you may encounter issues if you're running 64bit. If you encounter any of these cases (or potentially others) we recommend installing PhantomJS manually and telling teabag where the bin is located.

Using your own installation / bin

If you'd rather use a different installation of phantomjs, you can tell Teabag to do that by setting the phantomjs_bin configuration directive, or by setting the PHANTOMJS_BIN environment variable.

http://phantomjs.org/download.html

teabag_env.rb

Teabag.setup do |config|
  config.phantomjs_bin = "/path/to/phantomjs"
end

And when running the rake task.

rake teabag PHANTOMJS_BIN=phantomjs

If all else fails, you might want to consider Using Selenium WebDriver.

Travis CI

The following can be placed into a .travis.yml. Since TravisCI has PhantomJS installed you can just tell Teabag to use that one.

.travis.yml

env:
  - PHANTOMJS_BIN=phantomjs