watir-webdriver phantomjs and ghostdriver
Asked Answered
M

1

7

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!

Mychal answered 21/11, 2012 at 11:37 Comment(1)
I poked around and couldn't see anything obvious for headless. Did you consider running a virtualbox linux for running tests?Betweenwhiles
D
21

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/

Dicarlo answered 5/2, 2013 at 12:20 Comment(2)
Additionally, it is important to note that you have to install the most recent version of selenium-webdriver. With 2.25.0 people report they could not initialize. Upgrading to selenium-webdriver-2.31.0 allowed driver to work with phantomjs.Peridium
Please help me. I want to turn off the logging information for phantomjs here - #28117705Blandishments

© 2022 - 2024 — McMap. All rights reserved.