ZombieDriver provides a bridge for the Zombie.js browser emulator. Zombie.js is a headless browser emulator, written in node.js. It supports all JS interactions that :doc:`Selenium </drivers/selenium2>` and :doc:`Sahi </drivers/sahi>` do and works almost as fast as Goutte does. It is the best of both worlds actually, but still limited to only one browser type (Webkit). Also it is still slower than Goutte and requires node.js and npm to be installed on the system.
ZombieDriver is available through Composer:
$ composer require behat/mink-zombie-driver
In order to talk with a zombie.js server, you need to install and configure zombie.js first:
Install node.js by following instructions from the official site: http://nodejs.org/.
Install npm (node package manager) by following the instructions from http://npmjs.org/.
Install zombie.js with npm:
$ npm install -g zombie
After installing npm and zombie.js, you'll need to add npm libs to your
The easiest way to do this is to add:
After that, you'll be able to just use ZombieDriver without manual server setup. The driver will do all that for you automatically:
$driver = new \Behat\Mink\Driver\ZombieDriver( new \Behat\Mink\Driver\NodeJS\Server\ZombieServer() );
If you want more control during driver initialization, like for example if you want to configure the driver to init the server on a specific port, use the more verbose version:
$driver = new \Behat\Mink\Driver\ZombieDriver( new \Behat\Mink\Driver\Zombie\Server($host, $port, $nodeBin, $script) );
$host simply defines the host on which zombie.js will be started. It's
127.0.0.1 by default.
$port defines a zombie.js port. Default one is
$nodeBin defines full path to node.js binary. Default one is just
$script defines a node.js script to start zombie.js server. If you pass
null the default script will be used. Use this option carefully!