When comparing Zombie.js vs PhantomJS, the Slant community recommends PhantomJS for most people. In the question“What are the best headless browsers for testing?” PhantomJS is ranked 1st while Zombie.js is ranked 4th.
Ranked in these QuestionsQuestion Ranking
Pros
Pro Runs on Node.js
Zombie is built on node.js, making it very easy to integrate with your project and into your testing toolchain. It only requires JavaScript to run.
Pro Fully featured api based interaction and assertion
The way the api is built makes it very easy to add to your test framework.
Pro Claims to be "Insanely Fast"
It's a lot faster than fully fletched browsers and a lot lighter. Partly because it really only focuses on headless loading of pages along with their JavaScript (not taking really care of rendering or more visual resources).
Pro Supports screen capture
Pro Used in many open source projects
Pro Supports many browser standards
PhantomJS has full DOM and CSS parsing, JSON, canvas, and SVG support.
Pro Built on WebKit
WebKit is becoming the gold standard for browser compatibility, making it a good starting point for native headless browser testing.
Cons
Con Support has waned
As of August 19, 2016, Zombie hasn't received a commit since January 2016. Issues get comments like "patch welcome".
Con Stale documentation
Full API documentation has been missing since the start, making it frustrating to use.
Con Fails to load many sites
As its JavaScript and DOM engine are mostly "just good enough" and because by design it'll report all errors and stop there, many complex sites will not load properly through Zombie.js.
Con No screen-shot
As it doesn't render the page, you cannot get a screenshot to for testing or reporting test failures.
Con Deprecated by Puppeteer
PhantomJS is no longer actively maintained by the original authors. Puppeteer is said to be a replacement supported and backed by the Google Chrome team, now.
Con Heavy setup
You'll often end up having PhantomJS binaries connected via WebDriver to your testing framework, possibly using client/server especially if you want your test running with something else than Java. This means an overhead in terms of maintenance and performance, but still usually lighter than running a full browser (like Chrome, Firefox, IE).
Con Browser closes unexpectedly
It often happens when running on more then 5 (my measurement) JVM instances that the browser gets stuck and quits unexpectedly. This can be partially solved by running the instances one by one instead of parallel (this is a problem when testing Jenkins and Bamboo agents) but I don't believe this qualifies as a solution. The error is called UnreachableBrowserException
.
Con Elements are sometimes not visible
This is an error which occurs with almost no reason, PhantomJS sometimes decides that it cannot click the element even though the element is intractable or enabled.
This happens if you have to scroll to see the element (and these are not pages that load elements with JavaScript) which is strange because PhantomJS should catch the whole page if it is not loaded explicitly with JavaScript. This problem partially goes away with re-sizing the browser, but that does not really qualify as a solution.
The error it raises is: ElementNotVisibleException
.