When comparing PhantomJS vs Browsersync, the Slant community recommends Browsersync for most people. In the question“What are the best multi-browser testing tools with synchronized interactions?”Browsersync is ranked 1st while PhantomJS is ranked 4th. The most important reason people chose Browsersync is:

It is not constrained to a single device, it works across desktop and mobile devices at the same time. It will update code changes, synchronize scroll positions and form inputs automatically across all browsers and devices.

Pros

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.

Pro

Works concurrently across multiple devices

It is not constrained to a single device, it works across desktop and mobile devices at the same time. It will update code changes, synchronize scroll positions and form inputs automatically across all browsers and devices.

Pro

Synchronized form field input

When filling out a form in one browser, same information will be repeated in other browsers.

Pro

Cross-platform

Pro

CSS injection

Once the monitored .css file is saved, changes are implemented without a refresh.

Pro

Free and open source

Licensed under MIT.

Pro

Remembers scroll position

Remembers scroll position and synchronize it across all browsers so you don't have to move to the appropriate part of the page after each reload.

Pro

Works as a standalone npm package or as a Grunt plugin

To install as a standalone npm package

npm install -g browser-sync

To install as a grunt-plugin

npm install grunt-browser-sync

Pro

Synchronized navigation

When navigating in one browser, other browsers will automatically follow to the same place.

Pro

Doesn't require a browser plugin

BrowserSync does not require a browser plugin to be installed. This is because it serves the files directly itself, and uses a script which opens a socket between the browser and the server.

Pro

Works with older versions of IE

Browser-Sync works with all supported IE versions - IE7 and up.

Ad

Cons

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.

Con

Setting up in Windows can be a little tricky

Sometimes when setting up BrowserSync in Windows some errors will pop up. Most of the time this is because npm throws errors when trying to compile BrowserSync and some of the dependencies need Visual C++ runtime libraries.

This is easily solvable by installing Visual Studio. Once it's installed, there should not be any more problems.

Alternative Products

Each month, over 2.8 million people use Slant to find the best products and share their knowledge. Pick the tags you’re passionate about to get a personalized feed and begin contributing your knowledge.