ZombieDriver

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 Selenium and 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.

Installation

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:

  1. Install node.js by following instructions from the official site: http://nodejs.org/.

  2. Install npm (node package manager) by following the instructions from http://npmjs.org/.

  3. Install zombie.js with npm:

    $ npm install -g zombie
    

After installing npm and zombie.js, you’ll need to add npm libs to your NODE_PATH. The easiest way to do this is to add:

export NODE_PATH="/PATH/TO/NPM/node_modules"

into your .bashrc.

Usage

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)
);

Note

$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 8124.

$nodeBin defines full path to node.js binary. Default one is just node.

$script defines a node.js script to start zombie.js server. If you pass a null the default script will be used. Use this option carefully!