-
Notifications
You must be signed in to change notification settings - Fork 242
Using PhantomJS
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.
If you'd rather use a different installation of phantomjs, you can tell Teabag to do that by setting the phantomjs_bin
configuration directive.
http://phantomjs.org/download.html
teabag_env.rb
Teabag.setup do |config|
config.phantomjs_bin = "/path/to/phantomjs"
end
This can be overridden by using the PHANTOMJS_BIN environment variable. Use rake teabag PHANTOMJS_BIN=phantomjs
or PHANTOMJS_BIN=phantomjs bundle exec teabag
.
If all else fails, you might want to consider Using Selenium WebDriver.
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