Skip to content

Instantly share code, notes, and snippets.

@MegaBedder
Last active October 7, 2018 03:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MegaBedder/a4d418398884ef8d7b5c33e973da6ed6 to your computer and use it in GitHub Desktop.
Save MegaBedder/a4d418398884ef8d7b5c33e973da6ed6 to your computer and use it in GitHub Desktop.
Browser emulators & controllers

Headless Browser

A headless browser is a web browser without a graphical user interface.

Headless browsers provide automated control of a web page in an environment similar to popular web browsers, but are executed via a command-line interface or using network communication.

They are particularly useful for testing web pages as they are able to render and understand HTML the same way a browser would, including execution of JavaScript and AJAX which are usually not available when using other testing methods.

Headless browsers are used for:

  • Test automation in modern web applications.
  • Taking screenshots of web pages.
  • Running automated tests for JavaScript libraries.
  • Scraping web sites for data.
  • Automating interaction of web pages.

Headless browser emulators

  • Pure HTTP browser emulators.
  • Send a real HTTP requests against an application and parse the response content.

Advantages:

  • Simplicity to run and configure
  • Speed
  • Ability to run it without the need of a real browser

Disadvantages:

  • No JS/AJAX support

Example:

  • Goutte
  • Zombie.js – a simulated browser environment for Node.js.
  • PhantomJS – a Scriptable Headless Browser using WebKit layout engine [development is suspended]
  • SlimerJS – a scriptable browser using Mozilla's Gecko layout engine.
  • CasperJS - Navigation scripting & testing utility for PhantomJS and SlimerJS [no longer actively maintained]
  • TrifleJS – a headless Internet Explorer scriptable browser using the Trident layout engine
  • Google Chrome (only on Linux and MacOS)
  • Splash – a headless web browser as service
  • Navalia - Drive a headless browser with ease by using GraphQL
  • List of headless web browser

Browser controllers

  • Those emulators aim to control the real browser.
  • Simulate user interactions on browser and are able to retrieve actual information from current browser page.

Advantage:

  • Support for JS/AJAX interactions on page

Disadvantage:

  • Require the installed browser
  • Need extra configuration
  • Usually much slower than headless counterparts

Examples:

  • Selenium: A browser automation testing framework and ecosystem.
  • Sahi

Browser engines

  • Blink (Google Chrome, Chromium, Opera and Vivaldi)
  • Gecko (Firefox browser)
  • Servo (Experimental Browser Engine, by Mozilla Research)
  • Goanna (fork of Mozilla's Gecko, used in the Pale Moon browser)
  • WebKit (Safari browser)

JavaScript engines

  • Google Chrome, the V8 engine (JavaScript, ECMA-262, edition 6)
  • V8 - open source, developed by Google, part of Google Chrome and Node.js
  • Mozilla Firefox, the SpiderMonkey, and Rhino (JavaScript, ECMA-262, edition 6)
  • SpiderMonkey, the first JavaScript engine, which powered Netscape Navigator and today powers Firefox
  • Rhino, managed by the Mozilla Foundation, open source, developed entirely in Java
  • Apple Safari, the Nitro engine (JavaScript, ECMA-262, edition 6)
  • JavaScriptCore - open source, marketed as Nitro and developed by Apple for Safari
  • Duktape, an embeddable engine, with focus on portability and a compact footprint.
  • JerryScript, is an ultra-lightweight JavaScript engine for the Internet of Things.
  • Esper, a JavaScript self-interpreter with a focus on sandboxed execution and runtime introspection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment