uuf6429 / mink-electron-driver
Mink Electron Driver
Requires
- php: >=5.6
- behat/behat: ~3.0
- behat/mink: ~1.7
- behat/mink-extension: ^2.2
- eloquent/composer-npm-bridge: ^3.0 || ^4.0
- roave/security-advisories: dev-master
- symfony/process: ^3.0 || ^4.0
- uuf6429/dnode-php-sync-client: ^2.0
Requires (Dev)
- mink/driver-testsuite: dev-master
- phpunit/phpunit: ^5.7
- psr/log: ~1.0
This package is not auto-updated.
Last update: 2020-01-24 16:40:18 UTC
README
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
- Build Tools may be required. These can be installed with one npm command
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.