When comparing PhantomJS vs Ghostlab, the Slant community recommends Ghostlab for most people. In the question“What are the best multi-browser testing tools with synchronized interactions?” Ghostlab is ranked 2nd while PhantomJS is ranked 3rd. The most important reason people chose Ghostlab is:
Doesn't need any additional software or browser extensions to be installed on any device. If every device is pointed to the IP address that it provides it will automatically reload that page on every file change.
Ranked in these QuestionsQuestion Ranking
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 Can be used without additional software on any browser
Doesn't need any additional software or browser extensions to be installed on any device. If every device is pointed to the IP address that it provides it will automatically reload that page on every file change.
Pro Testing page preset with a lot of useful information
Ghostlab offers a testing page which when opened displays a lot of useful information. Such as, but not limited to: viewport width and height, user agent string, pixel ratio etc...
Pro Synchronizes scrolls, clicks, reloads and form input across all connected clients
Every time the page is reloaded on a device, it's automatically reloaded on every other device connected. It also registers scrolls, form inputs and clicks across different devices and automatically synchronizes them to each connected device.
Pro Cross-browser and cross-device live reloading
Ghostlab offers developers the opportunity to test their site in multiple browsers and devices at the same time. Once the Ghostlab server is deployed, it offers an IP address running on port 8080 which automatically reloads on every file change.
Pro Easy setup
Setting up GhostLab is very easy, by simply dragging a URL or a local folder it creates automatically a new site entry and is ready to work.
It can then be named or choose the specified file extensions that need to be watched.
Pro Remote inspection of code on different devices.
Ghostlab utilizes weinre, an open-source remote debugger to remotely inspect the code on different devices. By double clicking the device name that needs to be inspected, and clicking the 'Debug' button, Ghostlab opens a Chrome inspector which can inspect any item in the page of the device and manipulate the CSS and HTML.
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 No Linux version
Ghostlab is available only for Windows and Mac, there is no Linux version. At least for the time being.
Con Not free
Ghostlab is proprietary and not free. It costs $49. Though there is a free 7-days trial.
