uuf6429/mink-electron-driver

This package is abandoned and no longer maintained. No replacement package was suggested.

Mink Electron Driver

1.3.0 2018-02-03 13:29 UTC

README

Build Status (Linux / TravisCI) Build Status (Windows / AppVeyor) Minimum PHP Version License Coverage Packagist Dependency Status

Mink Electron Driver (replaces JsonWireProtocol and PhantomJS with Electron)

Electron is between 2 to 3 times faster than PhantomJS (source).

Table Of Contents

Features and Advantages

  • Fully-featured web browser
  • Quite fast, compared to alternatives
  • Built with modern components
  • Well supported (Electron receives frequent updates)
  • Easily understandable codebase (it's either PHP or JS)
  • Well tested (in addition to Mink driver tests, there are others)

Requirements

There a few things which are not taken care of automatically depending on your system.

  • Basics
    • PHP (5.5+) and Composer
    • Node.js (4+) and npm
  • Linux
    • If run headless (ie, without a desktop) you need to install xvfb
    • Some libraries are required, more details here
  • Windows

Installation

First make sure that the requirements above are met.

Next, simply install the driver in your Behat project via Composer:

composer require uuf6429/mink-electron-driver

How Does It Work?

       PHP + Mink Driver Interface                    Node.js + Electron API
 ________________  |  ______________________     _____________  |  _______________ 
|  Behat + Mink  |_v_|       Client         |___|    Server   |_V_|   Electron    |
| (Your Project) |---| (ElectronDriver.php) |---| (Server.js) |---| (Web Browser) |
'----------------'   '----------------------' ^ '-------------'   '---------------'
                                              |
                      DNode comm. over UDS (with inet sockets fallback)

Since one cannot easily control Node.js from PHP, a client-server approach was taken, with a fast and lightweight transport (unix domain sockets) protocol (dnode).

The driver on the PHP side simply tells the server what to do and it controls the Electron web browser.

The main reason why a client-server approach was taken is that Mink is synchronous by design.