Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

watir-webdriver phantomjs and ghostdriver

I currently have a rails app that uses rspec and watir-webdriver for my integration tests. I want to run my integration tests in a headless browser (for speed purposes). Since my development is done on a mac the headless gem won't work for me. I am looking to phantomjs as the solution. Whereas phantomjs works well with rspec/capybara (via poltergeist) and there are plenty of examples on how to make that work, I can't find much in the way of getting it to work well with watir-webdriver and ghostdriver.

I have built the "special" phantomjs that ghostdriver requires but I am lost after that. Has anyone used this setup before (rails/watir-webdriver/ghostdriver)?

My main goal is to speed up my integration tests. So if anyone has a better suggestion than what I have described here, I am flexible :)

Any help is greatly appreciated!

like image 520
Derrick W Avatar asked Nov 21 '12 11:11

Derrick W


1 Answers

It is now fully supported by Watir-WebDriver and easy to get running:

Steps to get working on OSX

  • First make sure you have homebrew installed
  • brew update
  • brew install phantomjs
  • Run irb and start using GhostDriver!
require 'watir-webdriver'
b = Watir::Browser.new :phantomjs
b.goto "www.google.com"
b.url #"http://www.google.com.au/"
b.title #"Google"

See full details on this blog post: http://watirmelon.com/2013/02/05/watir-webdriver-with-ghostdriver-on-osx-headless-browser-testing/

like image 85
Alister Scott Avatar answered Sep 19 '22 10:09

Alister Scott