Mink Electron Driver (replaces JsonWireProtocol and PhantomJS with Electron)
Electron is between 2 to 3 times faster than PhantomJS (source).
- 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)
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
- Build Tools may be required. These can be installed with one npm command
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
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.